Agent unexpectedly stops streaming with invalid_param error #19443

Closed
opened 2026-02-21 19:59:54 -05:00 by yindo · 0 comments
Owner

Originally created by @kthilagarajan-agsft on GitHub (Oct 16, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.9.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When the agent is streaming the response, all of a sudden, I am getting the below response and the agent stops. It is not happening all the time. Only 1-2 out of 5 times.

data: {"event":"error","conversation_id":"6be173ed-fe4b-432a-9912-2346c41ed7a2","message_id":"53672972-4a49-42f1-8ea5-b42a47c3e60a","created_at":1760611379,"code":"invalid_param","status":400,"message":"Extra data: line 1 column 208 (char 207)"}

If I continue to message in the same conversation, it will not proceed. It displays the below error:

data: {"event":"error","conversation_id":"6be173ed-fe4b-432a-9912-2346c41ed7a2","message_id":"3906c0eb-dc7e-4c5f-b1ef-812f424473a1","created_at":1760612050,"code":"completion_request_error","status":400,"message":"[models] Bad Request Error, Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.5: all messages must have non-empty content except for the optional final assistant message'}, 'request_id': 'req_011CUAkezfxGCctrXsBNShsw'}"}

✔️ Expected Behavior

The agent should fail immediately if the request is invalid, not stop halfway through while executing multiple tool calls. Also, it should be able to continue functioning in the same conversation after an error, but right now it can’t.

Actual Behavior

I’m facing an issue where I send a request to the agent, it starts streaming, triggers the tool call, and everything seems normal—but then it suddenly hangs or stops mid-response. After that, if I send any additional messages in the same conversation, there’s no response at all. The first message at least streams partially before failing, but every message after that in the same thread immediately fails with a 400 Bad Request: invalid_request_error. Once a conversation hits this failure, it’s basically unusable.

Originally created by @kthilagarajan-agsft on GitHub (Oct 16, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [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, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.9.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When the agent is streaming the response, all of a sudden, I am getting the below response and the agent stops. It is not happening all the time. Only 1-2 out of 5 times. ``` data: {"event":"error","conversation_id":"6be173ed-fe4b-432a-9912-2346c41ed7a2","message_id":"53672972-4a49-42f1-8ea5-b42a47c3e60a","created_at":1760611379,"code":"invalid_param","status":400,"message":"Extra data: line 1 column 208 (char 207)"} ``` If I continue to message in the same conversation, it will not proceed. It displays the below error: ``` data: {"event":"error","conversation_id":"6be173ed-fe4b-432a-9912-2346c41ed7a2","message_id":"3906c0eb-dc7e-4c5f-b1ef-812f424473a1","created_at":1760612050,"code":"completion_request_error","status":400,"message":"[models] Bad Request Error, Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages.5: all messages must have non-empty content except for the optional final assistant message'}, 'request_id': 'req_011CUAkezfxGCctrXsBNShsw'}"} ``` ### ✔️ Expected Behavior The agent should fail immediately if the request is invalid, not stop halfway through while executing multiple tool calls. Also, it should be able to continue functioning in the same conversation after an error, but right now it can’t. ### ❌ Actual Behavior I’m facing an issue where I send a request to the agent, it starts streaming, triggers the tool call, and everything seems normal—but then it suddenly hangs or stops mid-response. After that, if I send any additional messages in the same conversation, there’s no response at all. The first message at least streams partially before failing, but every message after that in the same thread immediately fails with a 400 Bad Request: invalid_request_error. Once a conversation hits this failure, it’s basically unusable.
yindo added the 🐞 bug label 2026-02-21 19:59:54 -05:00
yindo closed this issue 2026-02-21 19:59:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#19443