github/github-mcp-server · error

%s exceeds the GraphQL Int maximum of %d

Error message

%s exceeds the GraphQL Int maximum of %d

What it means

Raised by intFromEntry (pkg/github/projects_batch.go:479) when issue_number is a valid positive int64 but exceeds math.MaxInt32 (2147483647), the maximum for a GraphQL Int on GitHub's API. This guard rejects values that the API itself would refuse, before any network call, and the item fails with 'invalid_item_ref'.

Source

Thrown at pkg/github/projects_batch.go:479

	}
	s, ok := v.(string)
	if !ok || s == "" {
		return "", fmt.Errorf("%s must be a non-empty string", key)
	}
	return s, nil
}

func intFromEntry(entry map[string]any, key string) (int, error) {
	v, ok := entry[key]
	if !ok {
		return 0, fmt.Errorf("missing %s", key)
	}
	n, err := validatePositiveInt64(v)
	if err != nil {
		return 0, fmt.Errorf("%s must be a positive integer: %w", key, err)
	}
	if n > math.MaxInt32 {
		return 0, fmt.Errorf("%s exceeds the GraphQL Int maximum of %d", key, int64(math.MaxInt32))
	}
	return int(n), nil
}

func validatePositiveInt64(value any) (int64, error) {
	n, err := validateAndConvertToInt64(value)
	if err != nil {
		return 0, err
	}
	if n <= 0 {
		return 0, fmt.Errorf("value must be greater than zero (got %d)", n)
	}
	return n, nil
}

type batchFieldSpec struct {
	id    int64
	name  string

View on GitHub (pinned to 0ea1f775a7)

Solutions

  1. Check the magnitude of the number — real issue numbers are small; if it looks like an ID, move it to item_id or node_id as appropriate
  2. Fix the source mapping that put a large numeric identifier into issue_number
  3. Add a range check (1..2147483647) in your pre-flight validation
  4. Investigate how the value was produced — this error is a symptom of corrupted input, not a GitHub-side limit you will hit legitimately

Example fix

// before
{"item_owner": "octo", "item_repo": "repo", "issue_number": 123456789012}
// after
{"item_owner": "octo", "item_repo": "repo", "issue_number": 1234}
Defensive patterns

Strategy: validation

Validate before calling

const maxInt32 = 2147483647
if f, ok := entry["issue_number"].(float64); ok && int64(f) > maxInt32 {
	return fmt.Errorf("issue_number %d exceeds GraphQL Int max %d", int64(f), maxInt32)
}

Type guard

func withinGraphQLIntRange(v any) bool { f, ok := v.(float64); return ok && int64(f) >= 1 && int64(f) <= 2147483647 }

Prevention

When it happens

Trigger: {"issue_number": 9999999999} or any integral value above 2147483647. Real GitHub issue numbers are far below this bound, so it almost always indicates corrupted data or a wrong field in the number slot.

Common situations: A database ID, timestamp, or phone-like number accidentally mapped into issue_number; sentinel values like 999999999999 used as placeholders; swapped columns where an item ID or project number lands in issue_number.

Related errors


AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15). Data as JSON: /api/errors/7649c80a9fc73bd8. Report an issue: GitHub.