{"record":{"id":"7ae960ffddc30630","repo":"github/copilot-sdk","slug":"unsupported-elicitation-content-value-type-t","errorCode":null,"errorMessage":"unsupported elicitation content value type %T","messagePattern":"unsupported elicitation content value type %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/session.go","lineNumber":1132,"sourceCode":"\t\t\treturn nil, err\n\t\t}\n\t\treturn rpc.UIElicitationNumberValue(f), nil\n\tcase string:\n\t\treturn rpc.UIElicitationStringValue(val), nil\n\tcase []string:\n\t\treturn rpc.UIElicitationStringArrayValue(val), nil\n\tcase []any:\n\t\tstrs := make([]string, len(val))\n\t\tfor i, item := range val {\n\t\t\ts, ok := item.(string)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unsupported elicitation string array item type %T\", item)\n\t\t\t}\n\t\t\tstrs[i] = s\n\t\t}\n\t\treturn rpc.UIElicitationStringArrayValue(strs), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported elicitation content value type %T\", v)\n\t}\n}\n\n// Capabilities returns the session capabilities reported by the server.\nfunc (s *Session) Capabilities() SessionCapabilities {\n\ts.capabilitiesMu.RLock()\n\tdefer s.capabilitiesMu.RUnlock()\n\treturn s.capabilities\n}\n\n// setCapabilities updates the session capabilities.\nfunc (s *Session) setCapabilities(caps *SessionCapabilities) {\n\ts.capabilitiesMu.Lock()\n\tdefer s.capabilitiesMu.Unlock()\n\tif caps != nil {\n\t\ts.capabilities = *caps\n\t} else {\n\t\ts.capabilities = SessionCapabilities{}","sourceCodeStart":1114,"sourceCodeEnd":1150,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/session.go#L1114-L1150","documentation":"Elicitation UI responses must arrive as one of the supported Go types (e.g. string, []any of strings) for conversion into rpc UI elicitation values. If the decoded value's type matches none of the handled cases, the conversion returns this error identifying the Go type via %T. It signals the host returned an elicitation content value in an unexpected shape.","triggerScenarios":"A host replies to a UI elicitation with a JSON type outside the accepted set, e.g. a bare number, boolean, object, or null, hitting the default branch of the conversion function.","commonSituations":"Host implementations returning objects for multi-value answers; schema/client disagreement about the answer type; protocol changes where new answer kinds are sent by newer hosts to older SDKs.","solutions":["Check the %T in the message to learn which JSON type the host returned","Ensure the host sends the value as a string or array of strings as the schema declares","Align host and SDK versions so the elicitation answer types are mutually supported","Add a conversion case if the type is legitimately part of a newer protocol you control"],"exampleFix":"// before\nreturn map[string]any{\"values\": [...]}, nil // object is unsupported\n// after\nreturn []any{\"a\", \"b\"}, nil","handlingStrategy":"type-guard","validationCode":"switch v.(type) {\ncase string, []any:\n    // supported\ndefault:\n    return fmt.Errorf(\"elicitation answer must be string or string array\")\n}","typeGuard":"func isSupportedElicitationValue(v any) bool {\n    switch t := v.(type) {\n    case string:\n        return true\n    case []any:\n        return allStrings(t)\n    default:\n        return false\n    }\n}","tryCatchPattern":"val, err := convert(v)\nif err != nil && strings.Contains(err.Error(), \"content value type\") {\n    return fmt.Errorf(\"host sent unsupported answer type; ask host to conform to schema\")\n}","preventionTips":["Declare answer types explicitly in the elicitation schema","Upgrade host/SDK together when answer kinds change","Reject non-string answers at the host UI layer"],"tags":["elicitation","type-mismatch","ui"],"backgroundTag":"type-mismatch","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"}