{"record":{"id":"a2301166342b8496","repo":"tinyhumansai/openhuman","slug":"branch-issue-segment-m-2-does-not-match-agen","errorCode":null,"errorMessage":"branch issue segment \"${m[2]}\" does not match agent issue ${agent.issue}","messagePattern":"branch issue segment \"(.+?)\" does not match agent issue (.+?)","errorType":"validation","errorClass":"SpecError","httpStatus":null,"severity":"error","filePath":"scripts/agent-batch/lib.mjs","lineNumber":130,"sourceCode":"    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}\"`,\n        `${at}.branch`,\n      );\n    }\n    if (Number(m[2]) !== agent.issue) {\n      throw new SpecError(\n        `branch issue segment \"${m[2]}\" does not match agent issue ${agent.issue}`,\n        `${at}.branch`,\n      );\n    }\n    if (seenBranch.has(agent.branch)) {\n      throw new SpecError(`duplicate branch \"${agent.branch}\"`, `${at}.branch`);\n    }\n    seenBranch.add(agent.branch);\n    if (!Array.isArray(agent.owned_paths) || agent.owned_paths.length === 0) {\n      throw new SpecError(\n        \"owned_paths must be a non-empty array\",\n        `${at}.owned_paths`,\n      );\n    }\n    for (let j = 0; j < agent.owned_paths.length; j++) {\n      const p = agent.owned_paths[j];\n      if (typeof p !== \"string\" || p.length === 0) {\n        throw new SpecError(","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/agent-batch/lib.mjs#L112-L148","documentation":"Capture group 2 of the branch (the numeric issue segment) must satisfy Number(m[2]) === agent.issue. This ties the branch to the same GitHub issue the agent tracks, so branch, issue, and PR all reference one unit of work. Path is \"agents[i].branch\"; both the branch segment and the agent issue are printed.","triggerScenarios":"Agent {\"id\": \"a01\", \"issue\": 5313, \"branch\": \"cursor/a01-5312-fix-ci\"} — issue was renumbered in the spec but not in the branch, or the branch was copy-pasted from a sibling agent keeping its issue number.","commonSituations":"Updating the issue field after GitHub assigned a different number; duplicating agent entries and changing only some fields; manually composing branches from a template.","solutions":["Align the branch's issue segment with agent.issue: cursor/a01-5312-... → cursor/a01-5313-...","Or correct agent.issue if the branch number was right","Generate branches from the agent fields (cursor/${id}-${issue}-${slug}) instead of writing them by hand"],"exampleFix":"// before\n{ \"id\": \"a01\", \"issue\": 5313, \"branch\": \"cursor/a01-5312-fix-ci-timeout\" }\n\n// after\n{ \"id\": \"a01\", \"issue\": 5313, \"branch\": \"cursor/a01-5313-fix-ci-timeout\" }","handlingStrategy":"validation","validationCode":"import { BRANCH_RE } from \"./scripts/agent-batch/lib.mjs\";\nfor (const [i, a] of spec.agents.entries()) {\n  const m = BRANCH_RE.exec(a.branch);\n  if (!m || Number(m[2]) !== a.issue) console.error(`agents[${i}].branch issue segment must equal agent.issue`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  validateSpec(spec);\n} catch (e) {\n  if (e instanceof SpecError && /branch issue segment/.test(e.message)) {\n    console.error(`regenerate the branch from the agent fields: ${e.message}`);\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Update branches whenever GitHub assigns different issue numbers","Derive branches from agent fields rather than editing them independently"],"tags":["validation","json","spec","agent-batch","consistency","github-issues"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}