github/copilot-sdk · error · IllegalStateException

Elicitation is not supported by the host. Check…

Error message

Elicitation is not supported by the host. Check session.getCapabilities().getUi().getElicitation().orElse(false) before calling UI methods.

What it means

Before any UI elicitation call, CopilotSession checks the negotiated session capabilities; assertElicitation() throws IllegalStateException if the host did not advertise ui.elicitation=true. Elicitation simply is not available in that environment.

Solutions

  1. Check session.getCapabilities().getUi().getElicitation().orElse(false) before invoking UI methods and branch to a non-UI flow otherwise
  2. Upgrade the host/extension to a version supporting elicitation
  3. Wait for the capabilities handshake to complete before evaluating support
  4. Provide a fallback prompt mechanism (e.g. log-based or callback input) when elicitation is unsupported

Example fix

// before
session.getUi().requestInput("Name?");
// after
boolean supported = session.getCapabilities().getUi().getElicitation().orElse(false);
if (supported) {
    session.getUi().requestInput("Name?");
} else {
    log.info("Elicitation unsupported; using fallback input flow");
}
Defensive patterns

Strategy: validation

Validate before calling

boolean elicitationSupported =
    session.getCapabilities() != null
        && session.getCapabilities().getUi() != null
        && session.getCapabilities().getUi().getElicitation().orElse(false);

Try / catch

try {
    session.getUi().requestInput("...");
} catch (IllegalStateException e) {
    if (e.getMessage().contains("Elicitation is not supported")) {
        // switch to non-UI fallback flow
    }
}

Prevention

When it happens

Trigger: Calling elicitation UI methods (e.g. showMessage/requestInput on the session's UI API) when capabilities is null, caps.getUi() is null, or caps.getUi().getElicitation() is empty/false.

Common situations: Running under hosts (IDE versions, CLI/agent runtimes) that do not implement elicitation; calling UI methods before capabilities were received; assuming feature parity across Copilot host versions.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at java/sdk/src/main/java/com/github/copilot/CopilotSession.java:1374

            if (executor != null) {
                CompletableFuture.runAsync(task, executor);
            } else {
                CompletableFuture.runAsync(task);
            }
        } catch (RejectedExecutionException e) {
            LOG.log(Level.WARNING, "Executor rejected elicitation task for requestId=" + requestId + "; running inline",
                    e);
            task.run();
        }
    }

    /**
     * Throws if the host does not support elicitation.
     */
    private void assertElicitation() {
        SessionCapabilities caps = capabilities;
        if (caps == null || caps.getUi() == null || !caps.getUi().getElicitation().orElse(false)) {
            throw new IllegalStateException("Elicitation is not supported by the host. "
                    + "Check session.getCapabilities().getUi().getElicitation().orElse(false) before calling UI methods.");
        }
    }

    /**
     * Implements {@link SessionUiApi} backed by the session's RPC connection.
     */
    private final class SessionUiApiImpl implements SessionUiApi {

        @Override
        public CompletableFuture<ElicitationResult> elicitation(ElicitationParams params) {
            assertElicitation();
            return getRpc().ui.elicitation(new SessionUiElicitationParams(sessionId, null, params.getMessage(),
                    new UIElicitationSchema(params.getRequestedSchema().getType(),
                            params.getRequestedSchema().getProperties(), params.getRequestedSchema().getRequired()),
                    null, null)).thenApply(resp -> {
                        var result = new ElicitationResult();
                        if (resp.action() != null) {

View on GitHub (pinned to cd8cf15dc3)