github/github-mcp-server · error
%s must be a positive integer: %w
Error message
%s must be a positive integer: %w
What it means
Raised by intFromEntry (pkg/github/projects_batch.go:476) when issue_number exists but fails validatePositiveInt64: it is not a number (string "42", bool, null, array), it is fractional (2.5), or it is zero/negative. The first failure is wrapped as 'issue_number must be a positive integer: <cause>' inside the combined 'must all be provided together' error, and the item is rejected as 'invalid_item_ref'.
Source
Thrown at pkg/github/projects_batch.go:476
v, ok := entry[key]
if !ok {
return "", fmt.Errorf("missing %s", key)
}
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
}
View on GitHub (pinned to 0ea1f775a7)
Solutions
- Send issue_number as an unquoted positive integer (1 or greater)
- Parse source strings to int before building the item — never forward raw strings
- Reject 0/negative/fractional placeholders at ingestion
- Confirm you did not accidentally put an item database ID or project number in issue_number
Example fix
// before
{"item_owner": "octo", "item_repo": "repo", "issue_number": "42"}
// after
{"item_owner": "octo", "item_repo": "repo", "issue_number": 42} Defensive patterns
Strategy: validation
Validate before calling
if v, ok := entry["issue_number"]; ok {
f, isNum := v.(float64)
if !isNum || f != float64(int64(f)) || int64(f) <= 0 {
return fmt.Errorf("issue_number must be a positive integer (got %v)", v)
}
} Type guard
func isPositiveJSONInt(v any) bool { f, ok := v.(float64); return ok && f == float64(int64(f)) && int64(f) > 0 } Prevention
- Parse issue numbers to integers when reading from any string source
- Reject 0, negative, and fractional placeholders before batch construction
- Double-check that the number slot actually holds an issue number, not an ID
When it happens
Trigger: {"issue_number": "42"} quoted; {"issue_number": 2.5}; {"issue_number": 0}; {"issue_number": -1}; {"issue_number": null}; {"issue_number": true}. All fail because validateAndConvertToInt64 only accepts integral float64/int64/int values greater than zero.
Common situations: Issue numbers quoted when exported from CSV/JSON files; a zero-value default from a struct; parsing an issue URL but capturing an empty string coerced to 0; upstream data quality issues with negative or fractional placeholders.
Related errors
- %s must be a non-empty string
- node_id must be a non-empty string
- item_id: %w
- item_owner, item_repo, and issue_number must all be provided
- missing %s
AI-assisted analysis of github/github-mcp-server@0ea1f775a7 (2026-08-15).
Data as JSON: /api/errors/5ab26b78380176a7.
Report an issue: GitHub.