{"record":{"id":"ed8980b4d0c98f17","repo":"github/copilot-sdk","slug":"elicitation-is-not-supported-by-the-host-check-se-ed8980","errorCode":null,"errorMessage":"Elicitation is not supported by the host. Check session.capabilities before calling UI methods.","messagePattern":"Elicitation is not supported by the host\\. Check session\\.capabilities before calling UI methods\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/copilot/session.py","lineNumber":2569,"sourceCode":"        except Exception:\n            # Handler failed — attempt to cancel so the request doesn't hang\n            try:\n                await self.rpc.ui.handle_pending_elicitation(\n                    UIHandlePendingElicitationRequest(\n                        request_id=request_id,\n                        result=UIElicitationResponse(\n                            action=UIElicitationResponseAction.CANCEL,\n                        ),\n                    )\n                )\n            except (JsonRpcError, ProcessExitedError, OSError):\n                pass  # Connection lost or RPC error — nothing we can do\n\n    def _assert_elicitation(self) -> None:\n        \"\"\"Raises if the host does not support elicitation.\"\"\"\n        ui_caps = self._capabilities.get(\"ui\", {})\n        if not ui_caps.get(\"elicitation\"):\n            raise RuntimeError(\n                \"Elicitation is not supported by the host. \"\n                \"Check session.capabilities before calling UI methods.\"\n            )\n\n    def _register_commands(self, commands: list[CommandDefinition] | None) -> None:\n        \"\"\"Register command handlers for this session.\n\n        Args:\n            commands: A list of CommandDefinition objects, or None to clear all commands.\n        \"\"\"\n        with self._command_handlers_lock:\n            self._command_handlers.clear()\n            if not commands:\n                return\n            for cmd in commands:\n                self._command_handlers[cmd.name] = cmd.handler\n\n    def _register_bearer_token_providers(","sourceCodeStart":2551,"sourceCodeEnd":2587,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/python/copilot/session.py#L2551-L2587","documentation":"Raised by CopilotSession._assert_elicitation in python/copilot/session.py when a UI method that requires elicitation (e.g. showing dialogs or input prompts via the session UI API) is called but the host's negotiated capabilities (session._capabilities['ui']['elicitation']) do not advertise elicitation support.","triggerScenarios":"Calling elicitation-dependent UI methods on SessionUiApi (lines ~788–884) after connecting to a host whose initialize response lacked ui.elicitation in its capabilities.","commonSituations":"Running against an older Copilot CLI/runtime version that predates elicitation support; embedding the SDK in a headless host that disables UI features; forgetting that capabilities differ between hosts and assuming elicitation is always available.","solutions":["Check session.capabilities['ui']['elicitation'] before calling any elicitation UI method and fall back to a non-UI flow when falsy.","Upgrade the Copilot CLI/host to a version that supports ui.elicitation.","Run the client against a host configuration that enables UI/elicitation features.","Guard calls in a helper that no-ops or routes to console input when elicitation is unsupported."],"exampleFix":"# before\nawait session.ui.show_dialog(\"Confirm\", \"Proceed?\")  # RuntimeError if host lacks elicitation\n\n# after\nui_caps = session.capabilities.get(\"ui\", {})\nif ui_caps.get(\"elicitation\"):\n    await session.ui.show_dialog(\"Confirm\", \"Proceed?\")\nelse:\n    proceed = input(\"Proceed? [y/N] \").lower() == \"y\"","handlingStrategy":"type-guard","validationCode":"if not session.capabilities.get(\"ui\", {}).get(\"elicitation\"):\n    raise UnsupportedFeatureError(\"host does not support elicitation\")","typeGuard":"def supports_elicitation(session) -> bool:\n    return bool(session.capabilities.get(\"ui\", {}).get(\"elicitation\"))","tryCatchPattern":"try:\n    await session.ui.show_dialog(title, body)\nexcept RuntimeError as e:\n    if \"Elicitation is not supported\" in str(e):\n        result = console_fallback(title, body)\n    else:\n        raise","preventionTips":["Always read session.capabilities before using UI/elicitation APIs.","Pin a host/CLI version that supports elicitation when your app depends on it.","Build a non-UI fallback path for headless environments."],"tags":["capabilities","elicitation","ui","unsupported-feature"],"backgroundTag":"feature-not-enabled","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"}