[GH-ISSUE #1200] No Documentation on BadRequestError #167

Closed
opened 2026-02-17 17:19:19 -05:00 by yindo · 1 comment
Owner

Originally created by @baebranch on GitHub (Oct 30, 2025).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/1200

When using langgraph and ChatOpenAI from langchain_openai with tools I sometimes get an error:
BadRequestError('Error code: 400 - {\'error\': {\'message\': "An assistant message with \'tool_calls\' must be followed by tool messages responding to each \'tool_call_id\'. The following tool_call_ids did not have response messages: call_8ndOzpCzkxBoh5slcqJq3mzG", \'type\': \'invalid_request_error\', \'param\': \'messages.[2].role\', \'code\': None}}')

The error isn't particularly the problem but there is no documentation I can find about "BadReqestError". It's not listed with other errors in the langgraph.errors module. I'd like to import it so I can catch this specific error and handle it aside from just checking for the error code

Originally created by @baebranch on GitHub (Oct 30, 2025). Original GitHub issue: https://github.com/langchain-ai/docs/issues/1200 When using langgraph and ChatOpenAI from langchain_openai with tools I sometimes get an error: `BadRequestError('Error code: 400 - {\'error\': {\'message\': "An assistant message with \'tool_calls\' must be followed by tool messages responding to each \'tool_call_id\'. The following tool_call_ids did not have response messages: call_8ndOzpCzkxBoh5slcqJq3mzG", \'type\': \'invalid_request_error\', \'param\': \'messages.[2].role\', \'code\': None}}')` The error isn't particularly the problem but there is no documentation I can find about "BadReqestError". It's not listed with other errors in the langgraph.errors module. I'd like to import it so I can catch this specific error and handle it aside from just checking for the error code
yindo closed this issue 2026-02-17 17:19:19 -05:00
Author
Owner

@mdrxy commented on GitHub (Oct 31, 2025):

This error is coming from OpenAI; I believe the full stack trace would reveal this.

https://community.openai.com/t/formatting-assistant-messages-after-tool-function-calls-in-gpt-conversations/535360

I'll see if we can document this on our end

@mdrxy commented on GitHub (Oct 31, 2025): This error is coming from OpenAI; I believe the full stack trace would reveal this. https://community.openai.com/t/formatting-assistant-messages-after-tool-function-calls-in-gpt-conversations/535360 I'll see if we can document this on our end
yindo changed title from No Documentation on BadRequestError to [GH-ISSUE #1200] No Documentation on BadRequestError 2026-06-05 17:25:26 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#167