github/github-mcp-server · error
parameter %s is not of type string, is %T
Error message
parameter %s is not of type string, is %T
What it means
Returned by OptionalStringArrayParam when a JSON array parameter contains an element that is not a string. Arrays decoded by encoding/json arrive as []any, and each element is individually asserted to string; the first non-string element aborts with the element's actual Go type in the message.
Source
Thrown at pkg/github/params.go:281
// 1. Checks if the parameter is present in the request, if not, it returns its zero-value
// 2. If it is present, iterates the elements and checks each is a string
func OptionalStringArrayParam(args map[string]any, p string) ([]string, error) {
// Check if the parameter is present in the request
if _, ok := args[p]; !ok {
return []string{}, nil
}
switch v := args[p].(type) {
case nil:
return []string{}, nil
case []string:
return v, nil
case []any:
strSlice := make([]string, len(v))
for i, v := range v {
s, ok := v.(string)
if !ok {
return []string{}, fmt.Errorf("parameter %s is not of type string, is %T", p, v)
}
strSlice[i] = s
}
return strSlice, nil
default:
return []string{}, fmt.Errorf("parameter %s could not be coerced to []string, is %T", p, args[p])
}
}
func convertStringSliceToBigIntSlice(s []string) ([]int64, error) {
int64Slice := make([]int64, len(s))
for i, str := range s {
val, err := convertStringToBigInt(str, 0)
if err != nil {
return nil, fmt.Errorf("failed to convert element %d (%s) to int64: %w", i, str, err)
}
int64Slice[i] = val
}View on GitHub (pinned to 0ea1f775a7)
Solutions
- Make every element of the array a JSON string, e.g. ["bug","priority"]
- Filter out null/non-string entries before calling the tool if the source list is heterogeneous
- Quote numeric-looking identifiers if the API accepts them as strings (GitHub logins/names are strings)
Example fix
// before
{"labels":["bug",3,null]}
// after
{"labels":["bug","3","enhancement"]} Defensive patterns
Strategy: type-guard
Validate before calling
func allStrings(args map[string]any, p string) bool {
v, ok := args[p]
if !ok {
return true // absent is fine for optional
}
arr, ok := v.([]any)
if !ok {
return false
}
for _, e := range arr {
if _, ok := e.(string); !ok {
return false
}
}
return true
} Type guard
func isStringArray(v any) bool {
switch t := v.(type) {
case []string:
return true
case []any:
for _, e := range t {
if _, ok := e.(string); !ok {
return false
}
}
return true
}
return false
} Prevention
- Always emit JSON arrays of quoted strings for label/assignee-style parameters
- Filter nulls from sourced lists before dispatch
- Let a JSON Schema validator (type: array, items: {type: string}) run client-side before send
When it happens
Trigger: Passing ["a", 1, "c"] where an element is a JSON number; mixing null (decodes to nil interface) into the array; passing objects or booleans as elements; client libraries normalizing string arrays to typed arrays before send.
Common situations: LLMs generating mixed-type arrays for parameters like add_labels or assignees; upstream data pipelines injecting counts or nulls into name lists; schema drift where an element type changed between server versions.
Related errors
- parameter %s could not be coerced to []string, is %T
- parameter %s could not be coerced to []int64, is %T
- failed to convert element %d (%s) to int64: %w
- parameter %s: failed to convert element %d (%s) to int64: %w
- each issue_fields item must be an object
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/913e765f0e30b6c8.
Report an issue: GitHub.