{"record":{"id":"abbcd37d62d00935","repo":"tinyhumansai/openhuman","slug":"issue-must-be-a-positive-integer","errorCode":null,"errorMessage":"issue must be a positive integer","messagePattern":"issue must be a positive integer","errorType":"validation","errorClass":"SpecError","httpStatus":null,"severity":"error","filePath":"scripts/agent-batch/lib.mjs","lineNumber":107,"sourceCode":"    const at = `agents[${i}]`;\n    if (!agent || typeof agent !== \"object\" || Array.isArray(agent)) {\n      throw new SpecError(\"must be an object\", at);\n    }\n    for (const key of REQUIRED_AGENT) {\n      if (!(key in agent))\n        throw new SpecError(`missing required field \"${key}\"`, at);\n    }\n    if (typeof agent.id !== \"string\" || !/^a\\d{2,3}$/.test(agent.id)) {\n      throw new SpecError(\n        `id must match /^a\\\\d{2,3}$/ (got \"${agent.id}\")`,\n        `${at}.id`,\n      );\n    }\n    if (seenId.has(agent.id))\n      throw new SpecError(`duplicate id \"${agent.id}\"`, `${at}.id`);\n    seenId.add(agent.id);\n    if (!Number.isInteger(agent.issue) || agent.issue <= 0) {\n      throw new SpecError(\"issue must be a positive integer\", `${at}.issue`);\n    }\n    if (seenIssue.has(agent.issue)) {\n      throw new SpecError(`duplicate issue #${agent.issue}`, `${at}.issue`);\n    }\n    seenIssue.add(agent.issue);\n    if (typeof agent.title !== \"string\" || agent.title.trim().length === 0) {\n      throw new SpecError(\"title must be a non-empty string\", `${at}.title`);\n    }\n    const m = BRANCH_RE.exec(agent.branch);\n    if (!m) {\n      throw new SpecError(\n        `branch must match cursor/<id>-<issue>-<slug> (got \"${agent.branch}\")`,\n        `${at}.branch`,\n      );\n    }\n    if (m[1] !== agent.id) {\n      throw new SpecError(\n        `branch id segment \"${m[1]}\" does not match agent id \"${agent.id}\"`,","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/agent-batch/lib.mjs#L89-L125","documentation":"Per-agent issue must be a positive integer (Number.isInteger && > 0) — each agent maps to exactly one distinct GitHub issue. Like the top-level tracking_issue, no string coercion happens, so \"5312\" fails. Path is \"agents[i].issue\".","triggerScenarios":"\"issue\": 0 (placeholder not replaced), -1, 12.5, \"5312\" (quoted), or null inside an agent entry.","commonSituations":"Writing the spec before the issues are opened and leaving 0 placeholders; quoting numbers when hand-authoring JSON; float artifacts from generators computing issue offsets.","solutions":["Open the GitHub issue for that agent, then set the unquoted positive integer","Remove quotes / fix arithmetic so the value is an integer > 0","Ensure it does not collide with another agent's issue (else error 191 fires next)"],"exampleFix":"// before\n{ \"id\": \"a02\", \"issue\": 0, ... }\n\n// after\n{ \"id\": \"a02\", \"issue\": 5313, ... }","handlingStrategy":"validation","validationCode":"for (const [i, a] of spec.agents.entries()) {\n  if (!Number.isInteger(a.issue) || a.issue <= 0) {\n    console.error(`agents[${i}].issue must be a positive integer`);\n    process.exit(1);\n  }\n}","typeGuard":"/** @param {unknown} v */\nfunction isPositiveInt(v) {\n  return typeof v === \"number\" && Number.isInteger(v) && v > 0;\n}","tryCatchPattern":"try {\n  validateSpec(spec);\n} catch (e) {\n  if (e instanceof SpecError && e.path?.endsWith(\".issue\")) {\n    console.error(`agent issue number bad: ${e.message}`);\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Open all agent issues before authoring the spec so no placeholders remain","Grep the spec for \"issue\": 0 to catch placeholders before validation"],"tags":["validation","json","spec","agent-batch","github-issues"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}