Hi Amya Singhal
Thank you for reaching out to Microsoft Q&A Forum and sharing your experience.
From your description, it appears you’re encountering an issue with your Python Teams agent built using the M365 Agent Toolkit. The error json.decoder.JSONDecodeError: Unterminated string starting at: typically means the JSON parser ran into incomplete or improperly formatted JSON.
To better understand, could you please provide:
- The full detailed error message, including the exact line or position where it fails.
- Clarification on the difference between the long
seed.xmlcontent and the shorter one (e.g., size, structure, or additional characters). - The logic you’re using to process the XML, and if possible, share the code snippet that reads the file.
- How you’re passing the XML into the Teams agent (e.g., as part of a JSON payload or directly in Python code).
In the meantime, I’ve looked into similar cases and found some insights:
This error may occur when a property or value in the JSON string is missing a closing quote or contains unescaped characters. Ensure the content is properly escaped and enclosed in quotes, especially if it includes special characters like quotes, backslashes, or newlines.
Another possibility is that the JSON becomes truncated when pasted or read from a file. Large files can hit read limits, resulting in incomplete data and parsing errors. Try manually reading the file and printing its content to confirm it’s complete. If you’re using a custom function such as file_get_contents, check whether the maxReadFile parameter is set high enough to handle large files. Increasing this limit has resolved similar issues for others.
Please let me know how you get on, as your feedback is valuable to the community.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.