Breaking Error in New Tongyi Plugin 0.0.21: "Extra data: line 1 column 20 (char 19)" When Calling Tools #254

Closed
opened 2026-02-16 10:18:36 -05:00 by yindo · 2 comments
Owner

Originally created by @llinvokerl on GitHub (May 6, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

main

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Upgrade Tongyi plugin to version 0.0.21
  2. Create an agent with any tongyi model
  3. Add both "Get Current Time" tool and "Time Conversion" tool
  4. Ask: "What's the current time in New York?"
  5. Observe the error where Tongyi partially loses the tool parameters from LLM response: delta.message.tool_calls[0].function.arguments, making it unparseable as JSON.

Image

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @llinvokerl on GitHub (May 6, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version main ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Upgrade Tongyi plugin to version 0.0.21 2. Create an agent with any tongyi model 3. Add both "Get Current Time" tool and "Time Conversion" tool 4. Ask: "What's the current time in New York?" 5. Observe the error where Tongyi partially loses the tool parameters from LLM response: `delta.message.tool_calls[0].function.arguments`, making it unparseable as JSON. ![Image](https://github.com/user-attachments/assets/d591bf93-5021-4511-bea5-ecd1d12fb4cb) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo closed this issue 2026-02-16 10:18:36 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (May 6, 2025):

The error "Extra data: line 1 column 20 (char 19)" suggests that the JSON parsing is encountering unexpected data beyond what it expects to process. This typically happens when the input string is not a valid JSON format or contains additional characters that are not part of a valid JSON structure.

In the context of the Tongyi plugin version 0.0.21, it seems that the tool parameters from the LLM response are not being correctly formatted as JSON, leading to this parsing error. The extract_tool_calls function in the FunctionCallAgentRunner class is likely using json.loads to parse the arguments string, and if this string is not properly formatted as JSON, it will result in such an error.

To address this issue, you might want to:

  1. Ensure that the arguments string is correctly formatted as JSON before it is passed to json.loads. This includes checking for any extraneous characters or formatting issues.
  2. Add error handling around the JSON parsing to catch and log any exceptions, which can help in diagnosing the exact nature of the malformed data.
  3. Review any recent changes in version 0.0.21 that might have affected how tool parameters are structured or passed from the LLM response to the agent.

These steps can help in identifying and resolving the issue with the tool parameter handling in the Tongyi plugin.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (May 6, 2025): <!-- Answer --> The error "Extra data: line 1 column 20 (char 19)" suggests that the JSON parsing is encountering unexpected data beyond what it expects to process. This typically happens when the input string is not a valid JSON format or contains additional characters that are not part of a valid JSON structure. In the context of the Tongyi plugin version 0.0.21, it seems that the tool parameters from the LLM response are not being correctly formatted as JSON, leading to this parsing error. The `extract_tool_calls` function in the `FunctionCallAgentRunner` class is likely using `json.loads` to parse the `arguments` string, and if this string is not properly formatted as JSON, it will result in such an error. To address this issue, you might want to: 1. Ensure that the `arguments` string is correctly formatted as JSON before it is passed to `json.loads`. This includes checking for any extraneous characters or formatting issues. 2. Add error handling around the JSON parsing to catch and log any exceptions, which can help in diagnosing the exact nature of the malformed data. 3. Review any recent changes in version 0.0.21 that might have affected how tool parameters are structured or passed from the LLM response to the agent. These steps can help in identifying and resolving the issue with the tool parameter handling in the Tongyi plugin. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/dec5ee37-0f5f-4c1e-a785-f868d07d4dca?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/dec5ee37-0f5f-4c1e-a785-f868d07d4dca?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/dec5ee37-0f5f-4c1e-a785-f868d07d4dca?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/dec5ee37-0f5f-4c1e-a785-f868d07d4dca?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/dec5ee37-0f5f-4c1e-a785-f868d07d4dca?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/dec5ee37-0f5f-4c1e-a785-f868d07d4dca?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/dec5ee37-0f5f-4c1e-a785-f868d07d4dca?feedback_type=other)</sup>
Author
Owner

@shaojun commented on GitHub (May 7, 2025):

similar error, the agent node with qwen-max-latest (strategy: Function calling) worked fine, but today after i upgrade both dify (via docker to latest version 1.3.1) and tongyi plug in( to latest version 0.0.21), the node can not be ran through any more:

Image

Image

Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"JSONDecodeError","message":"Expecting value: line 1 column 1 (char 0)"}

Downgrade tongyi plug in to version 0.0.18 fixed the problem while the 0.0.20 and 0.0.19 still can't.

@shaojun commented on GitHub (May 7, 2025): similar error, the agent node with qwen-max-latest (strategy: Function calling) worked fine, but today after i upgrade both dify (via docker to latest version 1.3.1) and tongyi plug in( to latest version 0.0.21), the node can not be ran through any more: ![Image](https://github.com/user-attachments/assets/b9926906-3079-4fd9-bde5-76e343966e0d) ![Image](https://github.com/user-attachments/assets/c8341378-a059-4d89-a7f8-d650517c3667) ``` Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"JSONDecodeError","message":"Expecting value: line 1 column 1 (char 0)"} ``` Downgrade `tongyi` plug in to version `0.0.18` fixed the problem while the `0.0.20` and `0.0.19` still can't.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#254