{"record":{"id":"4239e4801f129c5b","repo":"github/github-mcp-server","slug":"parameter-s-failed-to-convert-element-d-s-to","errorCode":null,"errorMessage":"parameter %s: failed to convert element %d (%s) to int64: %w","messagePattern":"parameter (.+?): failed to convert element (.+?) \\((.+?)\\) to int64: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/params.go","lineNumber":335,"sourceCode":"\tif _, ok := args[p]; !ok {\n\t\treturn []int64{}, nil\n\t}\n\n\tswitch v := args[p].(type) {\n\tcase nil:\n\t\treturn []int64{}, nil\n\tcase []string:\n\t\treturn convertStringSliceToBigIntSlice(v)\n\tcase []any:\n\t\tint64Slice := make([]int64, 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 []int64{}, fmt.Errorf(\"parameter %s is not of type string, is %T\", p, v)\n\t\t\t}\n\t\t\tval, err := convertStringToBigInt(s, 0)\n\t\t\tif err != nil {\n\t\t\t\treturn []int64{}, fmt.Errorf(\"parameter %s: failed to convert element %d (%s) to int64: %w\", p, i, s, err)\n\t\t\t}\n\t\t\tint64Slice[i] = val\n\t\t}\n\t\treturn int64Slice, nil\n\tdefault:\n\t\treturn []int64{}, fmt.Errorf(\"parameter %s could not be coerced to []int64, is %T\", p, args[p])\n\t}\n}\n\n// WithPagination adds REST API pagination parameters to a tool.\n// https://docs.github.com/en/rest/using-the-rest-api/using-pagination-in-the-rest-api\nfunc WithPagination(schema *jsonschema.Schema) *jsonschema.Schema {\n\tschema.Properties[\"page\"] = &jsonschema.Schema{\n\t\tType:        \"number\",\n\t\tDescription: \"Page number for pagination (min 1)\",\n\t\tMinimum:     jsonschema.Ptr(1.0),\n\t}\n","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/params.go#L317-L353","documentation":"Returned by OptionalBigIntArrayParam when an element is a valid string but convertStringToBigInt (ParseInt base 10, 64-bit) rejects it. Identical failure surface to error 267 but hit through the []any branch where elements were individually asserted to string first; the parameter name, index, and element value are included.","triggerScenarios":"[\"ok\",\"12.5\"] style arrays where one element is non-numeric or empty; an ID string exceeding int64 range; elements with whitespace, commas, or exponent notation.","commonSituations":"Mixed-quality ID lists assembled from multiple API pages; stale cached IDs whose format changed (e.g. GraphQL global node IDs confused with numeric database IDs); user-entered IDs from a form with stray characters.","solutions":["Validate each element with strconv.ParseInt client-side and drop/report invalid entries before the call","Confirm you are collecting numeric database IDs, not base64 GraphQL node IDs (those belong in string ID params)","Normalize external input (trim, de-format) at ingestion time"],"exampleFix":"// before\n{\"column_ids\":[\"3743572\",\"MDM6VGVzdA==\"]}\n// after\n{\"column_ids\":[\"3743572\"]}","handlingStrategy":"validation","validationCode":"func validateBigIntArray(args map[string]any, p string) error {\n    v, ok := args[p]\n    if !ok {\n        return nil\n    }\n    arr, ok := v.([]any)\n    if !ok {\n        if ss, ok2 := v.([]string); ok2 {\n            arr = toAnySlice(ss)\n        } else {\n            return fmt.Errorf(\"%s must be an array\", p)\n        }\n    }\n    for i, e := range arr {\n        s, ok := e.(string)\n        if !ok {\n            return fmt.Errorf(\"%s[%d] must be a string, got %T\", p, i, e)\n        }\n        if _, err := strconv.ParseInt(s, 10, 64); err != nil {\n            return fmt.Errorf(\"%s[%d]=%q invalid int64: %w\", p, i, s, err)\n        }\n    }\n    return nil\n}","typeGuard":"func isValidBigIntArrayParam(args map[string]any, p string) bool {\n    return validateBigIntArray(args, p) == nil\n}","tryCatchPattern":"ids, err := github.OptionalBigIntArrayParam(args, \"repository_ids\")\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to convert element\") {\n        // element-level problem: clean the list and retry once\n        ids, err = github.OptionalBigIntArrayParam(cleanedArgs(args), \"repository_ids\")\n    }\n    if err != nil {\n        return err\n    }\n}","preventionTips":["Validate ID arrays with strconv.ParseInt before dispatch","Do not mix GraphQL node IDs into numeric-ID arrays","Fail fast on the first bad element in ingestion pipelines rather than at call time"],"tags":["go","mcp","arrays","strconv","type-conversion"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}