github/github-mcp-server · error
numeric value out of int range: %v
Error message
numeric value out of int range: %v
What it means
Thrown by toInt in pkg/github/params.go when a valid, finite, integral number exceeds the platform int range (f > math.MaxInt or f < math.MinInt). On 64-bit platforms this takes values above ~9.2e18; on 32-bit builds the ceiling is much lower (~2.1e9), so the same request can fail only on 32-bit servers.
Source
Thrown at pkg/github/params.go:87
case float64:
f = v
case string:
var err error
f, err = strconv.ParseFloat(v, 64)
if err != nil {
return 0, fmt.Errorf("invalid numeric value: %s", v)
}
default:
return 0, fmt.Errorf("expected number, got %T", val)
}
if math.IsNaN(f) || math.IsInf(f, 0) {
return 0, fmt.Errorf("non-finite numeric value")
}
if f != math.Trunc(f) {
return 0, fmt.Errorf("non-integer numeric value: %v", f)
}
if f > math.MaxInt || f < math.MinInt {
return 0, fmt.Errorf("numeric value out of int range: %v", f)
}
return int(f), nil
}
// toInt64 converts a value to int64, handling both float64 and string representations.
// Some MCP clients send numeric values as strings. It rejects NaN, ±Inf,
// fractional values, and values that lose precision in the float64→int64 conversion.
func toInt64(val any) (int64, error) {
var f float64
switch v := val.(type) {
case float64:
f = v
case string:
var err error
f, err = strconv.ParseFloat(v, 64)
if err != nil {
return 0, fmt.Errorf("invalid numeric value: %s", v)
}View on GitHub (pinned to 0ea1f775a7)
Solutions
- Send a value within int range (roughly ±2.1e9 on 32-bit, ±9.2e18 on 64-bit).
- For large GitHub IDs, use the tools whose parameters go through RequiredBigInt (int64) rather than the int path.
- Clamp absurd computed values (page*per_page overflow, default-to-max idioms) before sending.
Example fix
// before
arguments = { owner, repo, per_page: 9223372036854775807 };
// after
arguments = { owner, repo, per_page: 100 }; Defensive patterns
Strategy: validation
Validate before calling
function clampInt(v, min, max) {
return Math.min(Math.max(Math.trunc(v), min), max);
}
// e.g. arguments.per_page = clampInt(requestedPer, 1, 100); Try / catch
On 'numeric value out of int range', clamp to a sane bound (per_page <= 100, page small) and retry; if the value is an ID, switch to a bigint-typed tool parameter.
Prevention
- Never use MaxInt-style sentinels for 'give me everything' — per_page has a hard API cap anyway.
- Know your deployment's platform: 32-bit server builds have a much lower int ceiling.
- Clamp computed page offsets before sending.
When it happens
Trigger: per_page: 1e20 or page: 99999999999999999999 sent to an int parameter; IDs designed for int64 (e.g. large project/item IDs) routed to a plain-int tool parameter.
Common situations: Confusing an int-typed parameter with a bigint-typed one (comment_id/field_id/item_id use RequiredBigInt); sentinel values like 9223372036854775807 used as 'max'; 32-bit container builds lowering the ceiling.
Related errors
- invalid numeric value: %s
- expected number, got %T
- non-finite numeric value
- non-integer numeric value: %v
- parameter %s is not a valid number: %w
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/f0339f67655958c7.
Report an issue: GitHub.