{"record":{"id":"d92a55d1d4ce3adc","repo":"github/github-mcp-server","slug":"parameter-s-could-not-be-coerced-to-string-is","errorCode":null,"errorMessage":"parameter %s could not be coerced to []string, is %T","messagePattern":"parameter (.+?) could not be coerced to \\[\\]string, is %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/params.go","lineNumber":287,"sourceCode":"\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}\n\treturn int64Slice, nil\n}\n\nfunc convertStringToBigInt(s string, def int64) (int64, error) {\n\tv, err := strconv.ParseInt(s, 10, 64)\n\tif err != nil {","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/params.go#L269-L305","documentation":"Returned by OptionalStringArrayParam's default switch branch when the parameter is neither nil, []string, nor []any, i.e. the JSON value is a scalar or object where an array of strings is required. This is the top-level shape mismatch rather than an element-level one.","triggerScenarios":"Passing a single string \"bug\" instead of [\"bug\"]; passing an integer or boolean; passing an object like {\"0\":\"bug\"}; clients that serialize arrays as comma-joined strings before sending.","commonSituations":"LLMs collapsing one-element arrays to scalars; users writing comma-separated strings like \"bug,priority\" expecting server-side splitting; schemas that declare type string where the handler requires array.","solutions":["Wrap the value in a JSON array: [\"bug\"] even for a single item","If you have a comma-separated string, split it client-side first and send the resulting array","Align the tool's jsonschema type: array with items type string so clients generate the right shape"],"exampleFix":"// before\n{\"add_labels\":\"bug,priority\"}\n// after\n{\"add_labels\":[\"bug\",\"priority\"]}","handlingStrategy":"validation","validationCode":"func ensureStringSlice(args map[string]any, p string) error {\n    switch args[p].(type) {\n    case nil, []string, []any:\n        return nil\n    }\n    return fmt.Errorf(\"%s must be a JSON array of strings\", p)\n}\n// helper to fix single-string or joined inputs:\nfunc toSlice(v any) []string {\n    if s, ok := v.(string); ok {\n        return strings.Split(s, \",\")\n    }\n    return nil\n}","typeGuard":"func isCoercibleToStringArray(v any) bool {\n    switch v.(type) {\n    case nil, []string, []any:\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Always bracket arrays, even single-element ones: [\"bug\"]","Split joined strings at the boundary where you build the request","Keep tool schemas accurate (type: array) so client codegen produces containers"],"tags":["go","mcp","arrays","shape-mismatch","parameter-validation"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}