Replies: 2 comments
-
|
Your error is caused by malformed JSON—specifically, an unterminated string—returned from your custom MCP or plugin. This usually happens when the MCP outputs incomplete or invalid JSON, which Dify tries to parse during agent message transformation or tool invocation. Intermittent success suggests your MCP sometimes returns valid JSON, but often doesn't. To fix this, ensure your MCP always returns well-formed JSON. Double-check that any string fields are properly quoted and closed, and that the overall structure matches what Dify expects. For agent plugins, each context item should include Also, review your MCP's logs and outputs for cases where the JSON might be truncated or malformed. If you’re streaming responses, make sure the stream is always completed and closed properly. If you recently changed your MCP or plugin code, check for any code paths that could return incomplete data. If you’re using a plugin or model that’s known to have compatibility issues (like Tongyi in function calling mode), try switching to a different provider (such as OpenAI API) or ensure all required configuration fields are present, especially if you see errors about missing fields or descriptions example. Finally, make sure your Dify core and plugin-daemon versions are aligned, as version mismatches can cause similar issues. If you need to debug further, add logging to capture the exact JSON output from your MCP right before it’s returned to Dify, and validate it with a JSON linter. Let me know if you want more specific debugging steps or code examples! To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
same issue: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
Dify version
1.3.0
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
dify version: 1.3.0 source
agent node error
Using the custom MCP, the operation fails most of the time, but sometimes it can succeed.
Run failed: Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"JSONDecodeError","message":"Unterminated string starting at: line 1 column 80 (char 79)"}
2. Additional context or comments
No response
Beta Was this translation helpful? Give feedback.
All reactions