Error15 reports
Fix BadRequestError
in LangChain
✅ Solution
BadRequestError in Langchain often arises from malformed API requests to LLMs, commonly due to incorrect input formatting or exceeding token limits. Resolve this by validating your prompt structure, reducing prompt size, and ensuring your tool outputs conform to the schema expected by the LLM, particularly when using structured output or optional parameters. Retry with adjusted parameters after verifying these aspects.
Related Issues
Real GitHub issues where developers encountered this error:
Bug Report: MCP Tools Return List Instead of String, Breaking Chat Model SerializationJan 8, 2026
OpenAI.BadRequestError when using create_agent with structured output and tools with optional input parametersJan 4, 2026
AnthropicPromptCachingMiddleware applies cache_control to tool_use/tool_result blocks called by code_execution, causing API errorsDec 30, 2025
`SummarizationMiddleware` includes metadata in prompt causing context length overflowDec 29, 2025
In agent, there is no suitable reasoning_content for deepseekDec 20, 2025
Timeline
First reported:Oct 26, 2025
Last reported:Jan 8, 2026