{"record":{"id":"8c9d101c5a878795","repo":"github/github-mcp-server","slug":"each-item-requires-exactly-one-of-node-id-item-id","errorCode":null,"errorMessage":"each item requires exactly one of node_id, item_id, or item_owner + item_repo + issue_number","messagePattern":"each item requires exactly one of node_id, item_id, or item_owner \\+ item_repo \\+ issue_number","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/projects_batch.go","lineNumber":407,"sourceCode":"\t_, hasOwner := entry[\"item_owner\"]\n\t_, hasRepo := entry[\"item_repo\"]\n\t_, hasIssueNumber := entry[\"issue_number\"]\n\thasIssueRef := hasOwner || hasRepo || hasIssueNumber\n\n\tformsPresent := 0\n\tif hasNodeID {\n\t\tformsPresent++\n\t}\n\tif hasItemID {\n\t\tformsPresent++\n\t}\n\tif hasIssueRef {\n\t\tformsPresent++\n\t}\n\n\tswitch {\n\tcase formsPresent == 0:\n\t\treturn fmt.Errorf(\"each item requires exactly one of node_id, item_id, or item_owner + item_repo + issue_number\")\n\tcase formsPresent > 1:\n\t\treturn fmt.Errorf(\"each item must set exactly one of node_id, item_id, or item_owner + item_repo + issue_number, not more than one\")\n\t}\n\n\tswitch {\n\tcase hasNodeID:\n\t\ts, ok := entry[\"node_id\"].(string)\n\t\tif !ok || s == \"\" {\n\t\t\treturn fmt.Errorf(\"node_id must be a non-empty string\")\n\t\t}\n\t\tp.refKind = batchRefNodeID\n\t\tp.nodeID = s\n\tcase hasItemID:\n\t\tid, err := validatePositiveInt64(entry[\"item_id\"])\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"item_id: %w\", err)\n\t\t}\n\t\tp.refKind = batchRefItemID","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/projects_batch.go#L389-L425","documentation":"Raised by parseItemRef (pkg/github/projects_batch.go:407) when an entry in items[] contains none of the accepted item reference forms. Each item must carry exactly one of: node_id, item_id, or the triple item_owner + item_repo + issue_number. The offending item is marked code 'invalid_item_ref' and excluded from the batch; valid sibling items still execute.","triggerScenarios":"Passing items like {}, {\"title\":\"Fix login\"}, or an object whose reference keys are misspelled (camelCase nodeId/itemId, bare owner/repo/number, REST-style \"id\") so that node_id, item_id, item_owner, item_repo, and issue_number are all absent.","commonSituations":"Generating the items array from a CSV/template where reference columns are optional and blank; schema drift between an internal model (camelCase IDs) and the tool's snake_case arguments; copy-pasting a REST payload that uses \"id\" for the node ID.","solutions":["Add exactly one reference form to each failing item — node_id (string), item_id (positive integer), or item_owner + item_repo + issue_number together","Check the exact snake_case key names in items[i]; the error names them literally","Pre-validate the items array before calling the tool so one bad item does not waste a batch round-trip","Prefer node_id when you have it: it skips the extra lookup the other two forms require"],"exampleFix":"// before\n{\"items\": [{\"note\": \"no reference\"}], \"updated_field\": {\"name\": \"Status\", \"value\": \"Done\"}}\n// after\n{\"items\": [{\"node_id\": \"PVTI_lADOABC123\"}], \"updated_field\": {\"name\": \"Status\", \"value\": \"Done\"}}","handlingStrategy":"validation","validationCode":"// Go: validate each item before calling update_project_items\nfunc validRefKeys(it map[string]any) bool {\n\tn := 0\n\tfor _, k := range []string{\"node_id\", \"item_id\"} {\n\t\tif _, ok := it[k]; ok { n++ }\n\t}\n\tif _, ok := it[\"item_owner\"]; ok { n++ }\n\tif _, ok := it[\"item_repo\"]; ok { n++ }\n\tif _, ok := it[\"issue_number\"]; ok { n++ }\n\treturn n > 0\n}\nfor _, it := range items {\n\tif m, ok := it.(map[string]any); !ok || !validRefKeys(m) { return fmt.Errorf(\"item missing item reference: %v\", it) }\n}","typeGuard":"func hasAnyRefForm(entry map[string]any) bool {\n\tfor _, k := range []string{\"node_id\", \"item_id\", \"item_owner\", \"item_repo\", \"issue_number\"} {\n\t\tif _, present := entry[k]; present {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}","tryCatchPattern":null,"preventionTips":["Pre-validate the items array client-side and drop/fix items with no reference keys","Use exactly the snake_case key names the tool documents (node_id, item_id, item_owner, item_repo, issue_number)","Fail your pipeline early on blank reference columns instead of forwarding placeholder objects"],"tags":["github-projects","batch","input-validation","items"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}