{"record":{"id":"10fe9286a7aa1f9e","repo":"github/github-mcp-server","slug":"value-must-be-greater-than-zero-got-d","errorCode":null,"errorMessage":"value must be greater than zero (got %d)","messagePattern":"value must be greater than zero \\(got (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/projects_batch.go","lineNumber":490,"sourceCode":"\t\treturn 0, fmt.Errorf(\"missing %s\", key)\n\t}\n\tn, err := validatePositiveInt64(v)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"%s must be a positive integer: %w\", key, err)\n\t}\n\tif n > math.MaxInt32 {\n\t\treturn 0, fmt.Errorf(\"%s exceeds the GraphQL Int maximum of %d\", key, int64(math.MaxInt32))\n\t}\n\treturn int(n), nil\n}\n\nfunc validatePositiveInt64(value any) (int64, error) {\n\tn, err := validateAndConvertToInt64(value)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif n <= 0 {\n\t\treturn 0, fmt.Errorf(\"value must be greater than zero (got %d)\", n)\n\t}\n\treturn n, nil\n}\n\ntype batchFieldSpec struct {\n\tid    int64\n\tname  string\n\tvalue any\n}\n\nfunc parseBatchFieldSpec(raw any) (batchFieldSpec, error) {\n\tvar spec batchFieldSpec\n\tinput, ok := raw.(map[string]any)\n\tif !ok || input == nil {\n\t\treturn spec, fmt.Errorf(\"updated_field must be an object\")\n\t}\n\n\tvalue, hasValue := input[\"value\"]","sourceCodeStart":472,"sourceCodeEnd":508,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/projects_batch.go#L472-L508","documentation":"Raised by validatePositiveInt64 (pkg/github/projects_batch.go:490) when a value converts to int64 cleanly but is zero or negative. It is the innermost cause for item_id and updated_field.id, surfacing wrapped as e.g. 'item_id: value must be greater than zero (got 0)'. The affected item (or the whole request, for updated_field.id) fails validation before any API call.","triggerScenarios":"{\"item_id\": 0} or {\"item_id\": -3} — integral numbers that pass conversion but fail the > 0 check; likewise updated_field:{\"id\":0, ...}. Zero typically leaks from an uninitialized variable or a failed lookup that defaulted to 0.","commonSituations":"Go/JSON zero values from unfilled struct fields; a lookup that failed silently and returned 0 before the batch was built; sentinel -1 from 'not found' conventions forwarded verbatim.","solutions":["Find where the 0/negative value originates — usually a failed upstream lookup — and fix that","Skip items whose ID could not be resolved instead of sending 0","Assert id > 0 before adding the item to the batch or setting updated_field.id","Note GitHub item database IDs are always large positive integers; a small number like 0 or 1 is a mapping bug"],"exampleFix":"// before\n{\"items\": [{\"item_id\": 0}]}\n// after\n// resolve the real database ID first, then:\n{\"items\": [{\"item_id\": 9012345678}]}","handlingStrategy":"validation","validationCode":"if f, ok := entry[\"item_id\"].(float64); ok && int64(f) <= 0 {\n\treturn fmt.Errorf(\"item_id must be > 0 (got %d)\", int64(f))\n}\n// same check for updated_field[\"id\"]","typeGuard":"func isPositiveJSONInt(v any) bool { f, ok := v.(float64); return ok && int64(f) > 0 }","tryCatchPattern":null,"preventionTips":["Never let a zero-value or -1 'not found' sentinel reach the wire — resolve or skip","Assert id > 0 when building items and the updated_field spec","GitHub database IDs are large positive integers; tiny values indicate a lookup bug"],"tags":["github-projects","batch","input-validation","positive-int"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}