mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
siliconflow ImagePromptMessageContent is not JSON serializable #83
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 @holdbelief1 on GitHub (Mar 15, 2025).
Self Checks
Dify version
1.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
[siliconflow] Error: PluginInvokeError: {"args":{"description":"[models] Error: Object of type ImagePromptMessageContent is not JSON serializable"},"error_type":"InvokeError","message":"[models] Error: Object of type ImagePromptMessageContent is not JSON serializable"}
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
@dosubot[bot] commented on GitHub (Mar 15, 2025):
Hello @holdbelief1! I'm here to assist you with any bugs, questions, or contributions you have. Whether it's solving bugs, answering questions, or becoming a contributor, I'm here to help while you wait for a human maintainer.
I found a similar unsolved discussion regarding JSON serialization issues in Dify. The discussion mentions that the JSON in the HTTP tool cannot accept objects and can only accept strings, which leads to issues with escape characters in the JSON string processed by the code, preventing normal HTTP requests. You can view the discussion here [1].
For your specific issue with
ImagePromptMessageContentnot being JSON serializable, you might need to implement a custom serialization method. Dify uses thecreate_json_messagemethod for handling JSON serialization for custom objects, which might be useful in your case [2]. You may need to extend or modify this method to handle the serialization ofImagePromptMessageContentobjects.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
@filwu8 commented on GitHub (Apr 11, 2025):
[volcengine_maas] Error: PluginInvokeError: {"args":{},"error_type":"TypeError","message":"Object of type ImagePromptMessageContent is not JSON serializable"} 我也有相同问题
@fengzanfeng commented on GitHub (Jun 5, 2025):
Problem Analysis:
If the System Prompt contains image variables, this issue will be triggered. This occurs because Dify only applies JSON conversion logic to the User Prompt but not to the System Prompt, leading to this exception. It can be considered a defect in Dify's implementation.
Temporary Solution:
Open the Chatflow application and remove the image variables from the System Prompt.
Long-term Solution:
The dify-plugin-sdks code needs to be improved by adding conversion logic for System Prompt Messages.
@dosubot[bot] commented on GitHub (Aug 21, 2025):
Hi, @holdbelief1. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.
Issue Summary:
Next Steps:
Thank you for your understanding and contribution!