{"record":{"id":"913e765f0e30b6c8","repo":"github/github-mcp-server","slug":"parameter-s-is-not-of-type-string-is-t","errorCode":null,"errorMessage":"parameter %s is not of type string, is %T","messagePattern":"parameter (.+?) is not of type string, is %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/params.go","lineNumber":281,"sourceCode":"// 1. Checks if the parameter is present in the request, if not, it returns its zero-value\n// 2. If it is present, iterates the elements and checks each is a string\nfunc OptionalStringArrayParam(args map[string]any, p string) ([]string, error) {\n\t// Check if the parameter is present in the request\n\tif _, ok := args[p]; !ok {\n\t\treturn []string{}, nil\n\t}\n\n\tswitch v := args[p].(type) {\n\tcase nil:\n\t\treturn []string{}, nil\n\tcase []string:\n\t\treturn v, nil\n\tcase []any:\n\t\tstrSlice := make([]string, len(v))\n\t\tfor i, v := range v {\n\t\t\ts, ok := v.(string)\n\t\t\tif !ok {\n\t\t\t\treturn []string{}, fmt.Errorf(\"parameter %s is not of type string, is %T\", p, v)\n\t\t\t}\n\t\t\tstrSlice[i] = s\n\t\t}\n\t\treturn strSlice, nil\n\tdefault:\n\t\treturn []string{}, fmt.Errorf(\"parameter %s could not be coerced to []string, is %T\", p, args[p])\n\t}\n}\n\nfunc convertStringSliceToBigIntSlice(s []string) ([]int64, error) {\n\tint64Slice := make([]int64, len(s))\n\tfor i, str := range s {\n\t\tval, err := convertStringToBigInt(str, 0)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to convert element %d (%s) to int64: %w\", i, str, err)\n\t\t}\n\t\tint64Slice[i] = val\n\t}","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/params.go#L263-L299","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)"],"exampleFix":"// before\n{\"labels\":[\"bug\",3,null]}\n// after\n{\"labels\":[\"bug\",\"3\",\"enhancement\"]}","handlingStrategy":"type-guard","validationCode":"func allStrings(args map[string]any, p string) bool {\n    v, ok := args[p]\n    if !ok {\n        return true // absent is fine for optional\n    }\n    arr, ok := v.([]any)\n    if !ok {\n        return false\n    }\n    for _, e := range arr {\n        if _, ok := e.(string); !ok {\n            return false\n        }\n    }\n    return true\n}","typeGuard":"func isStringArray(v any) bool {\n    switch t := v.(type) {\n    case []string:\n        return true\n    case []any:\n        for _, e := range t {\n            if _, ok := e.(string); !ok {\n                return false\n            }\n        }\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["go","mcp","type-assertion","arrays","parameter-validation"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}