github/copilot-sdk · error
unsupported elicitation string array item type %T
Error message
unsupported elicitation string array item type %T
What it means
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.
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
Example fix
// before
items := []any{"a", 1} // panics into error
// after
items := []any{"a", "1"} // all strings Defensive patterns
Strategy: type-guard
Validate before calling
func allStrings(items []any) bool {
for _, it := range items {
if _, ok := it.(string); !ok { return false }
}
return true
} Type guard
func asStringArray(v []any) ([]string, bool) {
out := make([]string, len(v))
for i, it := range v {
s, ok := it.(string)
if !ok { return nil, false }
out[i] = s
}
return out, true
} Try / catch
res, err := convertElicitationValue(v)
if err != nil {
if strings.Contains(err.Error(), "string array item type") {
// fall back to per-item coercion or reject the submission
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- unsupported elicitation content value type %T
- Elicitation is not supported by the host. Check…
- Elicitation is not supported by the host. Check…
- Elicitation is not supported by the host. Check…
- elicitation is not supported by the host; check…
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/97ba63fa7f73332f.
Report an issue: GitHub.
Appendix: source
Thrown at go/session.go:1126
return rpc.UIElicitationNumberValue(float64(val)), nil
case uint64:
return rpc.UIElicitationNumberValue(float64(val)), nil
case json.Number:
f, err := val.Float64()
if err != nil {
return nil, err
}
return rpc.UIElicitationNumberValue(f), nil
case string:
return rpc.UIElicitationStringValue(val), nil
case []string:
return rpc.UIElicitationStringArrayValue(val), nil
case []any:
strs := make([]string, len(val))
for i, item := range val {
s, ok := item.(string)
if !ok {
return nil, fmt.Errorf("unsupported elicitation string array item type %T", item)
}
strs[i] = s
}
return rpc.UIElicitationStringArrayValue(strs), nil
default:
return nil, fmt.Errorf("unsupported elicitation content value type %T", v)
}
}
// Capabilities returns the session capabilities reported by the server.
func (s *Session) Capabilities() SessionCapabilities {
s.capabilitiesMu.RLock()
defer s.capabilitiesMu.RUnlock()
return s.capabilities
}
// setCapabilities updates the session capabilities.
func (s *Session) setCapabilities(caps *SessionCapabilities) {View on GitHub (pinned to cd8cf15dc3)