tinyhumansai/openhuman · error · SpecError

branch issue segment "${m[2]}" does not match agent issue ${

Error message

branch issue segment "${m[2]}" does not match agent issue ${agent.issue}

What it means

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.

Source

Thrown at scripts/agent-batch/lib.mjs:130

    seenIssue.add(agent.issue);
    if (typeof agent.title !== "string" || agent.title.trim().length === 0) {
      throw new SpecError("title must be a non-empty string", `${at}.title`);
    }
    const m = BRANCH_RE.exec(agent.branch);
    if (!m) {
      throw new SpecError(
        `branch must match cursor/<id>-<issue>-<slug> (got "${agent.branch}")`,
        `${at}.branch`,
      );
    }
    if (m[1] !== agent.id) {
      throw new SpecError(
        `branch id segment "${m[1]}" does not match agent id "${agent.id}"`,
        `${at}.branch`,
      );
    }
    if (Number(m[2]) !== agent.issue) {
      throw new SpecError(
        `branch issue segment "${m[2]}" does not match agent issue ${agent.issue}`,
        `${at}.branch`,
      );
    }
    if (seenBranch.has(agent.branch)) {
      throw new SpecError(`duplicate branch "${agent.branch}"`, `${at}.branch`);
    }
    seenBranch.add(agent.branch);
    if (!Array.isArray(agent.owned_paths) || agent.owned_paths.length === 0) {
      throw new SpecError(
        "owned_paths must be a non-empty array",
        `${at}.owned_paths`,
      );
    }
    for (let j = 0; j < agent.owned_paths.length; j++) {
      const p = agent.owned_paths[j];
      if (typeof p !== "string" || p.length === 0) {
        throw new SpecError(

View on GitHub (pinned to a221052e0d)

Solutions

  1. Align the branch's issue segment with agent.issue: cursor/a01-5312-... → cursor/a01-5313-...
  2. Or correct agent.issue if the branch number was right
  3. Generate branches from the agent fields (cursor/${id}-${issue}-${slug}) instead of writing them by hand

Example fix

// before
{ "id": "a01", "issue": 5313, "branch": "cursor/a01-5312-fix-ci-timeout" }

// after
{ "id": "a01", "issue": 5313, "branch": "cursor/a01-5313-fix-ci-timeout" }
Defensive patterns

Strategy: validation

Validate before calling

import { BRANCH_RE } from "./scripts/agent-batch/lib.mjs";
for (const [i, a] of spec.agents.entries()) {
  const m = BRANCH_RE.exec(a.branch);
  if (!m || Number(m[2]) !== a.issue) console.error(`agents[${i}].branch issue segment must equal agent.issue`);
}

Try / catch

try {
  validateSpec(spec);
} catch (e) {
  if (e instanceof SpecError && /branch issue segment/.test(e.message)) {
    console.error(`regenerate the branch from the agent fields: ${e.message}`);
    process.exit(1);
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Updating the issue field after GitHub assigned a different number; duplicating agent entries and changing only some fields; manually composing branches from a template.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16). Data as JSON: /api/errors/a2301166342b8496. Report an issue: GitHub.