{"record":{"id":"afb4c6c8c43d06a9","repo":"github/copilot-sdk","slug":"32603","errorCode":"-32603","errorMessage":"No GitHub token provider registered for registration ID {params.registration_id!r}","messagePattern":"No GitHub token provider registered for registration ID (.+?)","errorType":"error_code","errorClass":"JsonRpcError","httpStatus":null,"severity":"error","filePath":"python/copilot/client.py","lineNumber":761,"sourceCode":"\n@dataclass\nclass _GitHubTokenProviderRegistration:\n    provider: GitHubTokenProvider\n    session_id: str | None = None\n    committed: bool = False\n\n\nclass _GitHubTokenProviderAdapter:\n    \"\"\"Routes global GitHub token requests to opaque session registrations.\"\"\"\n\n    def __init__(self, client: CopilotClient) -> None:\n        self._client = client\n\n    async def get_token(self, params: GitHubTokenAcquireRequest) -> GitHubTokenAcquireResult:\n        with self._client._github_token_providers_lock:\n            registration = self._client._github_token_providers.get(params.registration_id)\n        if registration is None:\n            raise JsonRpcError(\n                -32603,\n                \"No GitHub token provider registered for registration ID \"\n                f\"{params.registration_id!r}\",\n            )\n\n        result = registration.provider(\n            GitHubTokenProviderArgs(\n                host=params.host,\n                session_id=params.session_id or registration.session_id,\n                reason=params.reason,\n            )\n        )\n        if inspect.isawaitable(result):\n            result = await result\n        # The generated global-handler wrapper forwards callback results directly,\n        # so the public tagged dictionary is already in the expected wire shape.\n        return cast(GitHubTokenAcquireResult, result)\n","sourceCodeStart":743,"sourceCodeEnd":779,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/python/copilot/client.py#L743-L779","documentation":"get_token handles a JSON-RPC request for a GitHub token but no provider was registered under the requested registration_id in the client's _github_token_providers map. The client raises JsonRpcError(-32603) (internal error) because it cannot fulfill the token request without a matching registration. This indicates a lifecycle mismatch: a token was requested for a registration the client never registered or has since removed.","triggerScenarios":"Calling the GitHub token acquire flow with params.registration_id that was never passed to the register-API (or was unregistered), reusing a registration_id from a different/older client instance, or a stale server-side request arriving after the provider was removed.","commonSituations":"Multiple CopilotClient instances in one process where the request lands on the wrong client; restarting the client and replaying old requests; race between unregistering a provider and an in-flight token request; typo in the registration ID string.","solutions":["Register the GitHub token provider under that exact registration_id before issuing token requests","Verify the registration_id used at acquire time matches the one used at registration (exact string, no whitespace)","Ensure the same CopilotClient instance that registered the provider handles the request","Add logging to dump client._github_token_providers keys and compare with the requested ID"],"exampleFix":"// before\nresult = await handler.get_token(GitHubTokenAcquireRequest(registration_id=\"gh-token-1\"))\n// after\nclient.register_github_token_provider(\"gh-token-1\", my_provider)  # must precede get_token\nresult = await handler.get_token(GitHubTokenAcquireRequest(registration_id=\"gh-token-1\"))","handlingStrategy":"try-catch","validationCode":"# before requesting a token\nwith client._github_token_providers_lock:\n    known = params.registration_id in client._github_token_providers\nif not known:\n    raise LookupError(f\"register provider for {params.registration_id!r} first\")","typeGuard":null,"tryCatchPattern":"from copilot.jsonrpc import JsonRpcError\ntry:\n    result = await handler.get_token(params)\nexcept JsonRpcError as e:\n    if e.code == -32603 and \"No GitHub token provider registered\" in str(e):\n        client.register_github_token_provider(params.registration_id, my_provider)\n        result = await handler.get_token(params)\n    else:\n        raise","preventionTips":["Register providers before any token acquire flow starts","Use a constant/enum for registration IDs instead of inline strings","Keep a single client instance per registration namespace","Log registered IDs at registration time to ease debugging"],"tags":["python","github-token","json-rpc","registration"],"backgroundTag":"entity-not-found","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}