github/copilot-sdk · error

elicitation is not supported by the host; check…

Error message

elicitation is not supported by the host; check session.Capabilities().UI.Elicitation before calling UI methods

What it means

SessionUI elicitation methods call assertElicitation, which reads the session capabilities reported by the host. If caps.UI is nil or caps.UI.Elicitation is false, the host has not advertised elicitation support, and every UI elicitation call fails with this guidance error instead of making a doomed RPC. The message itself points at the capability check the caller should have performed.

Solutions

  1. Check sess.Capabilities().UI != nil && sess.Capabilities().UI.Elicitation before calling UI methods
  2. Upgrade the host to a version that supports UI elicitation
  3. Ensure the client advertises/request the elicitation capability during session initialization
  4. Provide a non-UI fallback path (e.g. CLI prompt) when the capability is absent

Example fix

// before
res, err := ui.Elicitation(ctx, msg, schema)
// after
caps := sess.Capabilities()
if caps.UI == nil || !caps.UI.Elicitation {
    return promptFallback(msg)
}
res, err := ui.Elicitation(ctx, msg, schema)
Defensive patterns

Strategy: fallback

Validate before calling

caps := sess.Capabilities()
elicitationSupported := caps.UI != nil && caps.UI.Elicitation

Type guard

func supportsElicitation(c SessionCapabilities) bool {
    return c.UI != nil && c.UI.Elicitation
}

Try / catch

res, err := ui.Elicitation(ctx, msg, schema)
if err != nil && strings.Contains(err.Error(), "not supported by the host") {
    res, err = nonUIFallback(msg)
}

Prevention

When it happens

Trigger: Calling SessionUI.Elicitation / other UI methods on a session whose host capabilities do not include ui.elicitation (older host, different client, capability negotiation omitted it).

Common situations: Connecting to a host that predates elicitation support; a client that did not request/advertise elicitation during initialization; switching hosts without re-checking capabilities.

Related errors


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

Appendix: source

Thrown at go/session.go:1165

	if caps != nil {
		s.capabilities = *caps
	} else {
		s.capabilities = SessionCapabilities{}
	}
}

// UI returns the interactive UI API for showing elicitation dialogs.
// Methods on the returned SessionUI will error if the host does not support
// elicitation (check Capabilities().UI.Elicitation first).
func (s *Session) UI() *SessionUI {
	return &SessionUI{session: s}
}

// assertElicitation checks that the host supports elicitation and returns an error if not.
func (s *Session) assertElicitation() error {
	caps := s.Capabilities()
	if caps.UI == nil || !caps.UI.Elicitation {
		return fmt.Errorf("elicitation is not supported by the host; check session.Capabilities().UI.Elicitation before calling UI methods")
	}
	return nil
}

// Elicitation shows a generic elicitation dialog with a custom schema.
func (ui *SessionUI) Elicitation(ctx context.Context, message string, requestedSchema ElicitationSchema) (*ElicitationResult, error) {
	if err := ui.session.assertElicitation(); err != nil {
		return nil, err
	}
	rpcSchema, err := toRPCUIElicitationSchema(requestedSchema)
	if err != nil {
		return nil, err
	}
	rpcResult, err := ui.session.RPC.UI.Elicitation(ctx, &rpc.UIElicitationRequest{
		Message:         message,
		RequestedSchema: rpcSchema,
	})
	if err != nil {

View on GitHub (pinned to cd8cf15dc3)