{"record":{"id":"2068bb1c2d3d87f0","repo":"mermaid-js/mermaid","slug":"closest-parent-position-not-found-for-commit-com","errorCode":null,"errorMessage":"Closest parent position not found for commit ${commit.id}","messagePattern":"Closest parent position not found for commit (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/git/gitGraphRenderer.ts","lineNumber":192,"sourceCode":"      if (curPos <= maxPosition) {\n        maxPosition = curPos;\n      }\n      const x = branchPos.get(commit.branch)!.pos;\n      const y = curPos - LAYOUT_OFFSET;\n      commitPos.set(commit.id, { x: x, y: y });\n    }\n  });\n};\n\nconst findClosestParentPos = (commit: Commit): number => {\n  const closestParent = findClosestParent(commit.parents.filter((p) => p !== null));\n  if (!closestParent) {\n    throw new Error(`Closest parent not found for commit ${commit.id}`);\n  }\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;","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/git/gitGraphRenderer.ts#L174-L210","documentation":"Error \"Closest parent position not found for commit ${commit.id}\" thrown in mermaid-js/mermaid.","triggerScenarios":"Thrown at packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:192 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"}