Claude 4 Opus returns invalid_request_error in agent mode #355

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

Originally created by @MitraSafarinejad on GitHub (Jun 10, 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

1.3.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Hello team,

I'm currently using Dify v1.3.1 and encountered the following error while using the Claude 4 Opus model in agent mode:

[models] Bad Request Error, Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.1: all messages must have non-empty content except for the optional final assistant message'}}

Additionally, I've noticed that when I open the logs, the "Thinking..." timer starts
Although this issue was marked as fixed in #11238, it is still present in the latest version.

Image

✔️ Expected Behavior

The Claude model should respond to inputs in agent mode without errors, as long as all messages contain valid content.

Actual Behavior

The model returns a 400 error indicating that message 1 has empty content. However, from the user's side, all visible messages include content.
Starting a new chat can sometimes bypass this issue, but it recurs under certain conditions.

Originally created by @MitraSafarinejad on GitHub (Jun 10, 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 1.3.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Hello team, I'm currently using Dify v1.3.1 and encountered the following error while using the Claude 4 Opus model in agent mode: [models] Bad Request Error, Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.1: all messages must have non-empty content except for the optional final assistant message'}} Additionally, I've noticed that when I open the logs, the "Thinking..." timer starts Although this issue was marked as fixed in #11238, it is still present in the latest version. ![Image](https://github.com/user-attachments/assets/45c76905-8e9a-44dd-839a-b93fd88c1b0b) ### ✔️ Expected Behavior The Claude model should respond to inputs in agent mode without errors, as long as all messages contain valid content. ### ❌ Actual Behavior The model returns a 400 error indicating that message 1 has empty content. However, from the user's side, all visible messages include content. Starting a new chat can sometimes bypass this issue, but it recurs under certain conditions.
yindo closed this issue 2026-02-16 10:19:07 -05:00
Author
Owner

@fdb02983rhy commented on GitHub (Jun 10, 2025):

The issue occurred because the text portion didn’t get generated—you’re only seeing the “thinking” part. Try adjusting your prompt or regenerating the response before the point where the text portion is missing.

@fdb02983rhy commented on GitHub (Jun 10, 2025): The issue occurred because the text portion didn’t get generated—you’re only seeing the “thinking” part. Try adjusting your prompt or regenerating the response before the point where the text portion is missing.
Author
Owner

@dosubot[bot] commented on GitHub (Aug 19, 2025):

Hi, @MitraSafarinejad. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that in Dify v1.3.1 self-hosted via Docker, the Claude 4 Opus model intermittently returns a 400 invalid_request_error in agent mode due to empty message content.
  • This causes the model to fail and the "Thinking..." timer to run indefinitely.
  • New chats sometimes temporarily resolve the issue.
  • A user suggested the problem might be due to the text portion not being generated, recommending prompt adjustments or regenerating the response.
  • The issue remains unresolved and was previously discussed in #11238.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of the dify-official-plugins repository by commenting here.
  • If I don’t hear back within 5 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 19, 2025): Hi, @MitraSafarinejad. I'm [Dosu](https://dosu.dev), and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that in Dify v1.3.1 self-hosted via Docker, the Claude 4 Opus model intermittently returns a 400 invalid_request_error in agent mode due to empty message content. - This causes the model to fail and the "Thinking..." timer to run indefinitely. - New chats sometimes temporarily resolve the issue. - A user suggested the problem might be due to the text portion not being generated, recommending prompt adjustments or regenerating the response. - The issue remains unresolved and was previously discussed in #11238. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of the dify-official-plugins repository by commenting here. - If I don’t hear back within 5 days, I will automatically close this issue. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#355