{"record":{"id":"0ed94bec2de73869","repo":"mermaid-js/mermaid","slug":"closest-parent-not-found-for-commit-commit-id","errorCode":null,"errorMessage":"Closest parent not found for commit ${commit.id}","messagePattern":"Closest parent not found for commit (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/git/gitGraphRenderer.ts","lineNumber":187,"sourceCode":"    const commit = commits.get(key);\n\n    if (commit?.parents.length) {\n      const closestParent = findClosestParentBT(commit.parents)!;\n      curPos = commitPos.get(closestParent)!.y - COMMIT_STEP;\n      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) {","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/git/gitGraphRenderer.ts#L169-L205","documentation":"Error \"Closest parent not found for commit ${commit.id}\" thrown in mermaid-js/mermaid.","triggerScenarios":"Thrown at packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:187 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"}