{"record":{"id":"4af6c2347dca03ad","repo":"github/github-mcp-server","slug":"numeric-value-v-is-too-large-to-fit-in-int64","errorCode":null,"errorMessage":"numeric value %v is too large to fit in int64","messagePattern":"numeric value (.+?) is too large to fit in int64","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/params.go","lineNumber":118,"sourceCode":"\tcase string:\n\t\tvar err error\n\t\tf, err = strconv.ParseFloat(v, 64)\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"invalid numeric value: %s\", v)\n\t\t}\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"expected number, got %T\", val)\n\t}\n\tif math.IsNaN(f) || math.IsInf(f, 0) {\n\t\treturn 0, fmt.Errorf(\"non-finite numeric value\")\n\t}\n\tif f != math.Trunc(f) {\n\t\treturn 0, fmt.Errorf(\"non-integer numeric value: %v\", f)\n\t}\n\tresult := int64(f)\n\t// Check round-trip to detect precision loss for large int64 values\n\tif float64(result) != f {\n\t\treturn 0, fmt.Errorf(\"numeric value %v is too large to fit in int64\", f)\n\t}\n\treturn result, nil\n}\n\n// RequiredParam is a helper function that can be used to fetch a requested parameter from the request.\n// It does the following checks:\n// 1. Checks if the parameter is present in the request.\n// 2. Checks if the parameter is of the expected type.\n// 3. Checks if the parameter is not empty, i.e: non-zero value\nfunc RequiredParam[T comparable](args map[string]any, p string) (T, error) {\n\tvar zero T\n\n\t// Check if the parameter is present in the request\n\tif _, ok := args[p]; !ok {\n\t\treturn zero, fmt.Errorf(\"missing required parameter: %s\", p)\n\t}\n\n\t// Check if the parameter is of the expected type","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/params.go#L100-L136","documentation":"Thrown by toInt64 in pkg/github/params.go when the value is integral and finite but cannot be represented exactly as int64: either it exceeds the int64 range, or (the subtle case) a value in the 2^53..2^63 band was sent as a JSON number, lost precision in float64, and fails the float64(result) != f round-trip check.","triggerScenarios":"field_id sent as the JSON number 9007199254740993 (2^53+1, not representable in float64); comment_id like 1e19 overflowing int64; any ID above 9223372036854775807.","commonSituations":"Large GitHub/Projects v2 IDs serialized as JSON numbers by JS clients (JS numbers are float64, losing precision above 2^53); sending Number.MAX_SAFE_INTEGER+1; assuming the server will silently clamp.","solutions":["Send large IDs as decimal STRINGS, not JSON numbers — the string path through ParseFloat is the supported way to carry full-precision int64 values.","In JavaScript, keep IDs as strings or BigInt end-to-end and never route them through Number.","Confirm the value really is within int64 range; if it came from a prior tool response, re-read it from that response's raw string form."],"exampleFix":"// before (JS loses precision above 2^53)\narguments = { ownerId, itemId: 9007199254740993 };\n// after\narguments = { ownerId, itemId: \"9007199254740993\" };","handlingStrategy":"type-guard","validationCode":"function safeBigintArg(name, v) {\n  const s = typeof v === \"string\" ? v : String(v);\n  const n = Number(s);\n  if (!Number.isInteger(n) || Math.abs(n) > 9223372036854775807 || String(n) !== s) {\n    throw new Error(`${name}: send large ids as exact decimal strings`);\n  }\n  return s;\n}","typeGuard":"function isExactInt64String(v: unknown): v is string {\n  if (typeof v !== \"string\" || !/^-?\\d+$/.test(v)) return false;\n  const n = Number(v);\n  return Number.isSafeInteger(n) || Math.abs(BigInt(v)) <= 9223372036854775807n;\n}","tryCatchPattern":"On 'too large to fit in int64', locate where the id became a JS Number (precision already lost), re-fetch the original id string from the API response, and retry with the string form. Retrying the same number will always fail.","preventionTips":["In JS clients keep GitHub ids as strings or BigInt; never through Number (unsafe above 2^53).","Use JSON.parse with reviver or text-based extraction to preserve full-precision ids.","Remember JSON numbers cannot carry full int64 precision — strings are the contract."],"tags":["validation","numeric","precision-loss","bigint","json"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}