mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
Error in agent node using Pro/deepseek-ai/DeepSeek-V3.2(siliconflow) with think mode #891
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @leslie2046 on GitHub (Dec 20, 2025).
Self Checks
Dify version
1.11.1
Plugin version
0.0.38
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
✔️ Error log
Run failed: Failed to transform agent message: req_id: 83c93e6a67 PluginInvokeError: {"args":{},"error_type":"Exception","message":"read llm model failed: request failed: req_id: 600135f82c PluginInvokeError: {"args":{"description":"[models] Error: API request failed with status code 400: {\"code\":20015,\"message\":\"\\\"messages\\\" in request are illegal.\",\"data\":null}"},"error_type":"InvokeError","message":"[models] Error: API request failed with status code 400: {\"code\":20015,\"message\":\"\\\"messages\\\" in request are illegal.\",\"data\":null}"}"}
@dosubot[bot] commented on GitHub (Dec 20, 2025):
This error is likely caused by malformed or improperly escaped content in the messages payload sent to DeepSeek v3.2, especially when using think mode or function calling. The message array is built in several stages: agent parameters are rendered (sometimes as JSON strings), then converted and serialized before being sent to DeepSeek. If any step introduces double-escaped JSON, stray backslashes, or non-JSON-compliant content (for example, by injecting literal JSON strings into message fields that are then serialized again), DeepSeek will reject the request with a 400 and code 20015"messages in request are illegal".
In the current code, tool call arguments and some prompt content are serialized with
json.dumps(..., ensure_ascii=False), but if a stringified JSON object is injected into a message and then the whole message array is serialized again, you can end up with illegal escape sequences or double-encoded JSON. This is especially likely if you use templates or variables that already contain JSON strings, or if you manually construct message content with embedded JSON.To troubleshoot:
<think>...</think>tags or reasoning content are properly stripped or sanitized before serialization, as the OpenAI-compatible wrapper does some mutation here"OpenAI-compatible LLM wrapper".Recent updates to DeepSeek v3.2 support do not mention changes to message formatting or escaping, so this is likely a data/formatting issue in your workflow or agent configuration, not a plugin bug"DeepSeek v3.2 PR".
If you can, try to capture and share the actual messages payload being sent to DeepSeek for further debugging.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
@leslie2046 commented on GitHub (Dec 20, 2025):
output:
Conclusion: Two consecutive assistant messages will trigger an error
@leslie2046 commented on GitHub (Dec 20, 2025):
agent node mode
LOG in siliconflow plugin
Both normal.
My previous message also accurately reproduced the logic of the error, so this is actually a problem with the siliconflow server. We may need to do some compatibility processing in the plugin.
Agent APP mode
https://github.com/langgenius/dify/blob/7501360663efe879d716d8a962ce80181a21596b/api/core/agent/fc_agent_runner.py#L190C12-L205C61
These lines code will avoid consecutive assistant messages,but i think it lost reasoning_content as not expect ,will cause other problems.
LOG in siliconflow plugin