{"record":{"id":"03f5a92642b4d189","repo":"langchain-ai/langgraph","slug":"types-handler-already-set-for-r-a","errorCode":null,"errorMessage":"types.Handler already set for {r}, {a}.","messagePattern":"types\\.Handler already set for (.+?), (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/sdk-py/langgraph_sdk/auth/__init__.py","lineNumber":833,"sourceCode":"\ndef _register_handler(\n    auth: Auth,\n    resource: str | None,\n    action: str | None,\n    fn: types.Handler,\n) -> types.Handler:\n    _validate_handler(fn)\n    resource = resource or \"*\"\n    action = action or \"*\"\n    if resource == \"*\" and action == \"*\":\n        if auth._global_handlers:\n            raise ValueError(\"Global handler already set.\")\n        auth._global_handlers.append(fn)\n    else:\n        r = resource if resource is not None else \"*\"\n        a = action if action is not None else \"*\"\n        if (r, a) in auth._handlers:\n            raise ValueError(f\"types.Handler already set for {r}, {a}.\")\n        auth._handlers[(r, a)] = [fn]\n    return fn\n\n\ndef _validate_handler(fn: Callable[..., typing.Any]) -> None:\n    \"\"\"Validates that an auth handler function meets the required signature.\n\n    Auth handlers must:\n    1. Be async functions\n    2. Accept a ctx parameter of type AuthContext\n    3. Accept a value parameter for the data being authorized\n    \"\"\"\n    if not inspect.iscoroutinefunction(fn):\n        raise ValueError(\n            f\"Auth handler '{getattr(fn, '__name__', fn)}' must be an async function. \"\n            \"Add 'async' before 'def' to make it asynchronous and ensure\"\n            \" any IO operations are non-blocking.\"\n        )","sourceCodeStart":815,"sourceCodeEnd":851,"githubUrl":"https://github.com/langchain-ai/langgraph/blob/38031739e551638e373fb553453256c23feeb41f/libs/sdk-py/langgraph_sdk/auth/__init__.py#L815-L851","documentation":"Error \"types.Handler already set for {r}, {a}.\" thrown in langchain-ai/langgraph.","triggerScenarios":"Thrown at libs/sdk-py/langgraph_sdk/auth/__init__.py:833 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"}