{"record":{"id":"0d9e45698d57196c","repo":"github/copilot-sdk","slug":"github-token-and-github-token-provider-are-mutuall","errorCode":null,"errorMessage":"github_token and github_token_provider are mutually exclusive","messagePattern":"github_token and github_token_provider are mutually exclusive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/copilot/client.py","lineNumber":2533,"sourceCode":"        Raises:\n            ValueError: If ``on_permission_request`` is provided but not callable.\n\n        Example:\n            >>> session = await client.create_session(\n            ...     on_permission_request=PermissionHandler.approve_all,\n            ... )\n            >>>\n            >>> # Session with model and streaming\n            >>> session = await client.create_session(\n            ...     on_permission_request=PermissionHandler.approve_all,\n            ...     model=\"gpt-4\",\n            ...     streaming=True,\n            ... )\n        \"\"\"\n        if on_permission_request is not None and not callable(on_permission_request):\n            raise ValueError(\"on_permission_request must be callable when provided.\")\n        if github_token is not None and github_token_provider is not None:\n            raise ValueError(\"github_token and github_token_provider are mutually exclusive\")\n        if ask_user_variant not in (None, \"legacy\", \"elicitation\"):\n            raise ValueError('ask_user_variant must be \"legacy\" or \"elicitation\"')\n        if not self._client:\n            await self.start()\n\n        tool_defs = []\n        if tools:\n            for tool in tools:\n                definition: dict[str, Any] = {\n                    \"name\": tool.name,\n                    \"description\": tool.description,\n                }\n                if tool.parameters:\n                    definition[\"parameters\"] = tool.parameters\n                if tool.overrides_built_in_tool:\n                    definition[\"overridesBuiltInTool\"] = True\n                if tool.skip_permission:\n                    definition[\"skipPermission\"] = True","sourceCodeStart":2515,"sourceCodeEnd":2551,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/python/copilot/client.py#L2515-L2551","documentation":"Input validation in CopilotClient.create_session: the caller supplied both a static github_token and a github_token_provider callback. Only one GitHub credential source may be configured per session; supplying both is ambiguous, so the request is rejected before the session.create RPC is sent.","triggerScenarios":"Thrown at python/copilot/client.py:2533 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass only github_token for a static token","Pass only github_token_provider when the token must be resolved or refreshed dynamically","Remove the static token and wrap it in a provider callable if you need default-plus-override behavior"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}