{"record":{"id":"c62e3d064285de2b","repo":"langchain-ai/langgraph","slug":"number-of-tools-in-the-model-bind-tools-and-tool","errorCode":null,"errorMessage":"Number of tools in the model.bind_tools() and tools passed to create_react_agent must match Got {len(tools)} tools, expected {len(bound_tools) - num_builtin}","messagePattern":"Number of tools in the model\\.bind_tools\\(\\) and tools passed to create_react_agent must match Got (.+?) tools, expected (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py","lineNumber":194,"sourceCode":"    if isinstance(model, RunnableSequence):\n        model = next(\n            (\n                step\n                for step in model.steps\n                if isinstance(step, (RunnableBinding, BaseChatModel))\n            ),\n            model,\n        )\n\n    if not isinstance(model, RunnableBinding):\n        return True\n\n    if \"tools\" not in model.kwargs:\n        return True\n\n    bound_tools = model.kwargs[\"tools\"]\n    if len(tools) != len(bound_tools) - num_builtin:\n        raise ValueError(\n            \"Number of tools in the model.bind_tools() and tools passed to create_react_agent must match\"\n            f\" Got {len(tools)} tools, expected {len(bound_tools) - num_builtin}\"\n        )\n\n    tool_names = set(tool.name for tool in tools)\n    bound_tool_names = set()\n    for bound_tool in bound_tools:\n        # OpenAI-style tool\n        if bound_tool.get(\"type\") == \"function\":\n            bound_tool_name = bound_tool[\"function\"][\"name\"]\n        # Anthropic-style tool\n        elif bound_tool.get(\"name\"):\n            bound_tool_name = bound_tool[\"name\"]\n        else:\n            # unknown tool type so we'll ignore it\n            continue\n\n        bound_tool_names.add(bound_tool_name)","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py#L176-L212","documentation":"Error \"Number of tools in the model.bind_tools() and tools passed to create_react_agent must match Got {len(tools)} tools, expected {len(bound_tools) - num_builtin}\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/prebuilt/langgraph/prebuilt/chat_agent_executor.py:194 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"38031739e551638e373fb553453256c23feeb41f","analyzedAt":"2026-08-26T18:02:49.312Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}