github/copilot-sdk · error · RuntimeError

Elicitation is not supported by the host. Check…

Error message

Elicitation is not supported by the host. Check session.capabilities before calling UI methods.

What it means

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.

Solutions

  1. Check session.capabilities['ui']['elicitation'] before calling any elicitation UI method and fall back to a non-UI flow when falsy.
  2. Upgrade the Copilot CLI/host to a version that supports ui.elicitation.
  3. Run the client against a host configuration that enables UI/elicitation features.
  4. Guard calls in a helper that no-ops or routes to console input when elicitation is unsupported.

Example fix

# before
await session.ui.show_dialog("Confirm", "Proceed?")  # RuntimeError if host lacks elicitation

# after
ui_caps = session.capabilities.get("ui", {})
if ui_caps.get("elicitation"):
    await session.ui.show_dialog("Confirm", "Proceed?")
else:
    proceed = input("Proceed? [y/N] ").lower() == "y"
Defensive patterns

Strategy: type-guard

Validate before calling

if not session.capabilities.get("ui", {}).get("elicitation"):
    raise UnsupportedFeatureError("host does not support elicitation")

Type guard

def supports_elicitation(session) -> bool:
    return bool(session.capabilities.get("ui", {}).get("elicitation"))

Try / catch

try:
    await session.ui.show_dialog(title, body)
except RuntimeError as e:
    if "Elicitation is not supported" in str(e):
        result = console_fallback(title, body)
    else:
        raise

Prevention

When it happens

Trigger: Calling elicitation-dependent UI methods on SessionUiApi (lines ~788–884) after connecting to a host whose initialize response lacked ui.elicitation in its capabilities.

Common situations: 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.

Related errors


AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09). Data as JSON: /api/errors/ed8980b4d0c98f17. Report an issue: GitHub.

Appendix: source

Thrown at python/copilot/session.py:2569

        except Exception:
            # Handler failed — attempt to cancel so the request doesn't hang
            try:
                await self.rpc.ui.handle_pending_elicitation(
                    UIHandlePendingElicitationRequest(
                        request_id=request_id,
                        result=UIElicitationResponse(
                            action=UIElicitationResponseAction.CANCEL,
                        ),
                    )
                )
            except (JsonRpcError, ProcessExitedError, OSError):
                pass  # Connection lost or RPC error — nothing we can do

    def _assert_elicitation(self) -> None:
        """Raises if the host does not support elicitation."""
        ui_caps = self._capabilities.get("ui", {})
        if not ui_caps.get("elicitation"):
            raise RuntimeError(
                "Elicitation is not supported by the host. "
                "Check session.capabilities before calling UI methods."
            )

    def _register_commands(self, commands: list[CommandDefinition] | None) -> None:
        """Register command handlers for this session.

        Args:
            commands: A list of CommandDefinition objects, or None to clear all commands.
        """
        with self._command_handlers_lock:
            self._command_handlers.clear()
            if not commands:
                return
            for cmd in commands:
                self._command_handlers[cmd.name] = cmd.handler

    def _register_bearer_token_providers(

View on GitHub (pinned to cd8cf15dc3)