[PR #31838] fix: fix tool_response is omitted #33436

Open
opened 2026-02-21 20:53:17 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/31838

State: open
Merged: No


Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

fix #31741

2026-02-02 10:46:07,984 ERROR [base.py:305] 4238db1a49 Error in stream
 response for plugin {'code': -500, 'message': 
'{"message":"{\\"args\\":{\\"description\\":\\"[models] Error: API 
request failed with status code 400: 
{\\\\\\"error\\\\\\":{\\\\\\"message\\\\\\":\\\\\\"An assistant 
message with \'tool_calls\' must be followed by tool messages 
responding to each \'tool_call_id\'. (insufficient tool messages 
following tool_calls message)\\\\\\",\\\\\\"type\\\\\\":\\\\\\"invalid
_request_error\\\\\\",\\\\\\"param\\\\\\":null,\\\\\\"code\\\\\\":\\\\
\\"invalid_request_error\\\\\\"}}\\"},\\"error_type\\":\\"InvokeError\
\",\\"message\\":\\"[models] Error: API request failed with status 
code 400: {\\\\\\"error\\\\\\":{\\\\\\"message\\\\\\":\\\\\\"An 
assistant message with \'tool_calls\' must be followed by tool 
messages responding to each \'tool_call_id\'. (insufficient tool 
messages following tool_calls 
message)\\\\\\",\\\\\\"type\\\\\\":\\\\\\"invalid_request_error\\\\\\"
,\\\\\\"param\\\\\\":null,\\\\\\"code\\\\\\":\\\\\\"invalid_request_er
ror\\\\\\"}}\\"}","error_type":"PluginInvokeError","args":null}', 
'data': None}

Screenshots

Before After
... ...

after

image

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && npx lint-staged (frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/31838 **State:** open **Merged:** No --- > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary fix #31741 ``` 2026-02-02 10:46:07,984 ERROR [base.py:305] 4238db1a49 Error in stream response for plugin {'code': -500, 'message': '{"message":"{\\"args\\":{\\"description\\":\\"[models] Error: API request failed with status code 400: {\\\\\\"error\\\\\\":{\\\\\\"message\\\\\\":\\\\\\"An assistant message with \'tool_calls\' must be followed by tool messages responding to each \'tool_call_id\'. (insufficient tool messages following tool_calls message)\\\\\\",\\\\\\"type\\\\\\":\\\\\\"invalid _request_error\\\\\\",\\\\\\"param\\\\\\":null,\\\\\\"code\\\\\\":\\\\ \\"invalid_request_error\\\\\\"}}\\"},\\"error_type\\":\\"InvokeError\ \",\\"message\\":\\"[models] Error: API request failed with status code 400: {\\\\\\"error\\\\\\":{\\\\\\"message\\\\\\":\\\\\\"An assistant message with \'tool_calls\' must be followed by tool messages responding to each \'tool_call_id\'. (insufficient tool messages following tool_calls message)\\\\\\",\\\\\\"type\\\\\\":\\\\\\"invalid_request_error\\\\\\" ,\\\\\\"param\\\\\\":null,\\\\\\"code\\\\\\":\\\\\\"invalid_request_er ror\\\\\\"}}\\"}","error_type":"PluginInvokeError","args":null}', 'data': None} ``` ## Screenshots | Before | After | |--------|-------| | ... | ... | after <img width="1102" height="910" alt="image" src="https://github.com/user-attachments/assets/be74d009-95aa-474d-aabf-aa999c3ee69f" /> ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `make lint` and `make type-check` (backend) and `cd web && npx lint-staged` (frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:53:17 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33436