Agent error messages and how to fix them

9 errors that agent builders hit, with the message as the tool prints it. Each entry reproduces the error, explains the cause and shows a fix that was run, with links to the vendor docs or issue behind it. Use your browser's find to search for your error text. For an MCP server that won't start, try the config checker. For everything else, see the field guide.

Claude Code

  1. Claude Code MCP Failed to Connect: Read the Error, Then Fix It

    Failed to connect

    Fix a Claude Code MCP server stuck on Failed to connect: read the detail in claude mcp list, then fix paths, env vars, timeouts, approvals and URLs.

Claude API

  1. prompt is too long: Fix the Claude API Context Limit Error

    prompt is too long

    Fix the Claude API 400 prompt is too long error in agent loops: count tokens first, cap tool results, drop old turns without breaking pairs, or compact.

  2. Claude API 529 overloaded_error: Retries and Model Fallbacks

    529 overloaded_error

    Handle Claude API 529 overloaded_error in agent loops: what the SDK retries by default, longer backoff, falling back to another model, and errors in streams.

  3. tool_use ids without tool_result blocks: Claude API Fix

    tool_use ids were found without tool_result blocks immediately after

    Why the Claude API returns "tool_use ids were found without tool_result blocks immediately after", the six histories behind it and code to fix them.

MCP

  1. MCP error -32000: Connection closed: Fix stdio Servers That Exit

    MCP error -32000: Connection closed

    Fix MCP error -32000 Connection closed: find why a stdio server exits at startup, from import errors and missing env vars to relative paths and stdout.

OpenAI API

  1. Invalid schema for response_format: Fix OpenAI Strict Schemas

    Invalid schema for response_format

    Fix OpenAI structured outputs "Invalid schema" errors: additionalProperties false, every key in required, a root object, and keywords strict mode rejects.

MCP in Claude Desktop

  1. spawn npx ENOENT: MCP Server Not Showing Up in Claude Desktop

    spawn npx ENOENT

    Fix a local MCP server that won't show up in Claude Desktop: read the logs, fix spawn npx ENOENT with absolute paths and env PATH, and handle Windows.

OpenAI Agents SDK

  1. MaxTurnsExceeded in OpenAI Agents SDK: When to Raise max_turns

    agents.exceptions.MaxTurnsExceeded: Max turns (10) exceeded

    Why OpenAI Agents SDK raises MaxTurnsExceeded, what counts as a turn, the default of 10, and tested fixes to find the loop, handle it, resume or raise the cap.

LangGraph

  1. LangGraph GraphRecursionError: Fix the Recursion Limit Error

    GraphRecursionError: Recursion limit of 25 reached without hitting a stop condition

    Why LangGraph raises GraphRecursionError, what recursion_limit counts, the real defaults, and tested fixes with RemainingSteps and call limit middleware.