{"record":{"id":"97ba63fa7f73332f","repo":"github/copilot-sdk","slug":"unsupported-elicitation-string-array-item-type-t","errorCode":null,"errorMessage":"unsupported elicitation string array item type %T","messagePattern":"unsupported elicitation string array item type %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/session.go","lineNumber":1126,"sourceCode":"\t\treturn rpc.UIElicitationNumberValue(float64(val)), nil\n\tcase uint64:\n\t\treturn rpc.UIElicitationNumberValue(float64(val)), nil\n\tcase json.Number:\n\t\tf, err := val.Float64()\n\t\tif err != nil {\n\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) {","sourceCodeStart":1108,"sourceCodeEnd":1144,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/session.go#L1108-L1144","documentation":"When converting an elicitation UI response into an rpc.UIElicitationStringArrayValue, every element of the decoded []any must be a Go string. If any element is another JSON type (number, bool, object, null), the library returns this error naming the offending Go type. It protects the typed string-array contract of the elicitation API.","triggerScenarios":"A host returns an elicitation 'string array' answer where at least one element is not a JSON string, e.g. [\"a\", 42] or [\"a\", null], reaching the []any conversion branch.","commonSituations":"Host UI implementations that submit mixed-type selections; schema definitions declaring string arrays but the client UI returning numbers (e.g. indices); null entries from unchecked multi-selects.","solutions":["Validate the response items are all strings before submitting/returning them","Fix the host/UI to emit JSON strings for each selected value","If numbers are expected, declare the schema accordingly instead of a string array","Coerce/convert known numeric values to strings before the elicitation result is processed"],"exampleFix":"// before\nitems := []any{\"a\", 1} // panics into error\n// after\nitems := []any{\"a\", \"1\"} // all strings","handlingStrategy":"type-guard","validationCode":"func allStrings(items []any) bool {\n    for _, it := range items {\n        if _, ok := it.(string); !ok { return false }\n    }\n    return true\n}","typeGuard":"func asStringArray(v []any) ([]string, bool) {\n    out := make([]string, len(v))\n    for i, it := range v {\n        s, ok := it.(string)\n        if !ok { return nil, false }\n        out[i] = s\n    }\n    return out, true\n}","tryCatchPattern":"res, err := convertElicitationValue(v)\nif err != nil {\n    if strings.Contains(err.Error(), \"string array item type\") {\n        // fall back to per-item coercion or reject the submission\n    }\n    return err\n}","preventionTips":["Validate UI selections are all strings before submitting","Keep elicitation schemas and host answer types aligned","Coerce numbers/nulls to strings at the UI boundary"],"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"}