{"record":{"id":"38d8bc58963e1453","repo":"github/copilot-sdk","slug":"elicitation-is-not-supported-by-the-host-check-se-38d8bc","errorCode":null,"errorMessage":"elicitation is not supported by the host; check session.Capabilities().UI.Elicitation before calling UI methods","messagePattern":"elicitation is not supported by the host; check session\\.Capabilities\\(\\)\\.UI\\.Elicitation before calling UI methods","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/session.go","lineNumber":1165,"sourceCode":"\tif caps != nil {\n\t\ts.capabilities = *caps\n\t} else {\n\t\ts.capabilities = SessionCapabilities{}\n\t}\n}\n\n// UI returns the interactive UI API for showing elicitation dialogs.\n// Methods on the returned SessionUI will error if the host does not support\n// elicitation (check Capabilities().UI.Elicitation first).\nfunc (s *Session) UI() *SessionUI {\n\treturn &SessionUI{session: s}\n}\n\n// assertElicitation checks that the host supports elicitation and returns an error if not.\nfunc (s *Session) assertElicitation() error {\n\tcaps := s.Capabilities()\n\tif caps.UI == nil || !caps.UI.Elicitation {\n\t\treturn fmt.Errorf(\"elicitation is not supported by the host; check session.Capabilities().UI.Elicitation before calling UI methods\")\n\t}\n\treturn nil\n}\n\n// Elicitation shows a generic elicitation dialog with a custom schema.\nfunc (ui *SessionUI) Elicitation(ctx context.Context, message string, requestedSchema ElicitationSchema) (*ElicitationResult, error) {\n\tif err := ui.session.assertElicitation(); err != nil {\n\t\treturn nil, err\n\t}\n\trpcSchema, err := toRPCUIElicitationSchema(requestedSchema)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trpcResult, err := ui.session.RPC.UI.Elicitation(ctx, &rpc.UIElicitationRequest{\n\t\tMessage:         message,\n\t\tRequestedSchema: rpcSchema,\n\t})\n\tif err != nil {","sourceCodeStart":1147,"sourceCodeEnd":1183,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/session.go#L1147-L1183","documentation":"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.","triggerScenarios":"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).","commonSituations":"Connecting to a host that predates elicitation support; a client that did not request/advertise elicitation during initialization; switching hosts without re-checking capabilities.","solutions":["Check sess.Capabilities().UI != nil && sess.Capabilities().UI.Elicitation before calling UI methods","Upgrade the host to a version that supports UI elicitation","Ensure the client advertises/request the elicitation capability during session initialization","Provide a non-UI fallback path (e.g. CLI prompt) when the capability is absent"],"exampleFix":"// before\nres, err := ui.Elicitation(ctx, msg, schema)\n// after\ncaps := sess.Capabilities()\nif caps.UI == nil || !caps.UI.Elicitation {\n    return promptFallback(msg)\n}\nres, err := ui.Elicitation(ctx, msg, schema)","handlingStrategy":"fallback","validationCode":"caps := sess.Capabilities()\nelicitationSupported := caps.UI != nil && caps.UI.Elicitation","typeGuard":"func supportsElicitation(c SessionCapabilities) bool {\n    return c.UI != nil && c.UI.Elicitation\n}","tryCatchPattern":"res, err := ui.Elicitation(ctx, msg, schema)\nif err != nil && strings.Contains(err.Error(), \"not supported by the host\") {\n    res, err = nonUIFallback(msg)\n}","preventionTips":["Always gate UI calls on Capabilities().UI.Elicitation","Verify capability negotiation during session init in integration tests","Provide a non-UI fallback for hosts lacking elicitation"],"tags":["elicitation","capabilities","ui"],"backgroundTag":"operation-not-supported","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"}