{"record":{"id":"68efbcb549ac6267","repo":"mermaid-js/mermaid","slug":"branch-not-found-for-commit-commit-id","errorCode":null,"errorMessage":"Branch not found for commit ${commit.id}","messagePattern":"Branch not found for commit (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/git/gitGraphRenderer.ts","lineNumber":206,"sourceCode":"  }\n\n  const closestParentPos = commitPos.get(closestParent)?.y;\n  if (closestParentPos === undefined) {\n    throw new Error(`Closest parent position not found for commit ${commit.id}`);\n  }\n  return closestParentPos;\n};\n\nconst calculateCommitPosition = (commit: Commit): number => {\n  const closestParentPos = findClosestParentPos(commit);\n  return closestParentPos + COMMIT_STEP;\n};\n\nconst setCommitPosition = (commit: Commit, curPos: number): CommitPosition => {\n  const branch = branchPos.get(commit.branch);\n\n  if (!branch) {\n    throw new Error(`Branch not found for commit ${commit.id}`);\n  }\n\n  const x = branch.pos;\n  const y = curPos + LAYOUT_OFFSET;\n  commitPos.set(commit.id, { x, y });\n  return { x, y };\n};\n\nconst setRootPosition = (commit: Commit, curPos: number, defaultPos: number) => {\n  const branch = branchPos.get(commit.branch);\n  if (!branch) {\n    throw new Error(`Branch not found for commit ${commit.id}`);\n  }\n\n  const y = curPos + defaultPos;\n  const x = branch.pos;\n  commitPos.set(commit.id, { x, y });\n};","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/git/gitGraphRenderer.ts#L188-L224","documentation":"Error \"Branch not found for commit ${commit.id}\" thrown in mermaid-js/mermaid.","triggerScenarios":"Thrown at packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:206 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}