{"record":{"id":"32d8761e42f28008","repo":"github/copilot-sdk","slug":"ask-user-variant-must-be-legacy-or-elicitation","errorCode":null,"errorMessage":"ask_user_variant must be \"legacy\" or \"elicitation\"","messagePattern":"ask_user_variant must be \"legacy\" or \"elicitation\"","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/copilot/client.py","lineNumber":2535,"sourceCode":"\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\n                if tool.defer is not None:\n                    definition[\"defer\"] = tool.defer","sourceCodeStart":2517,"sourceCodeEnd":2553,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/python/copilot/client.py#L2517-L2553","documentation":"Input validation in CopilotClient.create_session: ask_user_variant was given a value other than the two supported wire values \"legacy\" or \"elicitation\". The variant selects how ask-user prompts are delivered by the runtime; any other string is rejected before session.create is issued.","triggerScenarios":"Thrown at python/copilot/client.py:2535 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass ask_user_variant=\"legacy\" for the classic prompt flow","Pass ask_user_variant=\"elicitation\" for the elicitation-style flow","Omit the argument to use the server default instead of guessing a value"],"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"}