dify icon indicating copy to clipboard operation
dify copied to clipboard

In the scenario of uploading attachments, if the LLM node has enabled the memory function, the second conversation will report an error

Open super-noodle opened this issue 7 months ago • 1 comments

Self Checks

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

Dify version

1.4.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

In the scenario of uploading attachments, if the LLM node has enabled the memory function, the second conversation will report an error。

Image

Image

✔️ Expected Behavior

normal operation

❌ Actual Behavior

Error reported

super-noodle avatar May 28 '25 10:05 super-noodle

This issue is known to occur when uploading attachments with the memory function enabled in the LLM node: the first upload works, but the second triggers an error (often "User message content must be str"). This is related to how certain models (such as DeepSeek-R1) handle system prompts in the conversation format—they do not support system prompts, which can cause this error when memory is enabled and files are uploaded in sequence.

The recommended solution is to move your system prompts into user prompts within your workflow configuration. This change ensures compatibility with models that do not support system prompts and resolves the error when using memory with file uploads. Disabling the memory function also avoids the issue, but if you need memory, adjusting the prompt configuration is the best approach. You can find more details and confirmation of this workaround in a similar issue report here.

If you need more specific guidance on how to adjust your workflow configuration, please provide the exact error message you see during the second conversation.

To reply, just mention my name @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

dosubot[bot] avatar May 28 '25 10:05 dosubot[bot]