{"record":{"id":"c39a57e8f7894dfe","repo":"langchain-ai/langgraph","slug":"arbitrary-types-are-not-supported-in-the-error-han","errorCode":null,"errorMessage":"Arbitrary types are not supported in the error handler signature. Please annotate the error with either a specific Exception type or a union of Exception types. For example, `def custom_handler(e: ValueError)` or `def custom_handler(e: Union[ValueError, TypeError])`. Got '{exception_type}' instead.","messagePattern":"Arbitrary types are not supported in the error handler signature\\. Please annotate the error with either a specific Exception type or a union of Exception types\\. For example, `def custom_handler\\(e: ValueError\\)` or `def custom_handler\\(e: Union\\[ValueError, TypeError\\]\\)`\\. Got '(.+?)' instead\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/prebuilt/langgraph/prebuilt/tool_node.py","lineNumber":503,"sourceCode":"                    \"All types in the error handler error annotation must be \"\n                    \"Exception types. For example, \"\n                    \"`def custom_handler(e: Union[ValueError, TypeError])`. \"\n                    f\"Got '{first_param.annotation}' instead.\"\n                )\n                raise ValueError(msg)\n\n            exception_type = type_hints[first_param.name]\n            if Exception in exception_type.__mro__:\n                return (exception_type,)\n            msg = (\n                f\"Arbitrary types are not supported in the error handler \"\n                f\"signature. Please annotate the error with either a \"\n                f\"specific Exception type or a union of Exception types. \"\n                \"For example, `def custom_handler(e: ValueError)` or \"\n                \"`def custom_handler(e: Union[ValueError, TypeError])`. \"\n                f\"Got '{exception_type}' instead.\"\n            )\n            raise ValueError(msg)\n\n    # If no type information is available, return (Exception,)\n    # for backwards compatibility.\n    return (Exception,)\n\n\ndef _filter_validation_errors(\n    validation_error: ValidationError,\n    injected_args: _InjectedArgs | None,\n) -> list[ErrorDetails]:\n    \"\"\"Filter validation errors to only include LLM-controlled arguments.\n\n    When a tool invocation fails validation, only errors for arguments that the LLM\n    controls should be included in error messages. This ensures the LLM receives\n    focused, actionable feedback about parameters it can actually fix. System-injected\n    arguments (state, store, runtime) are filtered out since the LLM has no control\n    over them.\n","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/prebuilt/langgraph/prebuilt/tool_node.py#L485-L521","documentation":"Error \"Arbitrary types are not supported in the error handler signature. Please annotate the error with either a specific Exception type or a union of Exception types. For example, `def custom_handler(e: ValueError)` or `def custom_handler(e: Union[ValueError, TypeError])`. Got '{exception_type}' instead.\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/prebuilt/langgraph/prebuilt/tool_node.py:503 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"}