mermaid-js/mermaid · error · Error
Position were undefined for commit ${commit.id}
Error message
Position were undefined for commit ${commit.id} What it means
Error "Position were undefined for commit ${commit.id}" thrown in mermaid-js/mermaid.
Source
Thrown at packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:555
const currentPosition = commitPos.get(commit.id) ?? defaultCommitPosition;
return currentPosition.y - COMMIT_STEP;
} else {
return 0;
}
}
return 0;
};
const getCommitPosition = (
commit: Commit,
pos: number,
isParallelCommits: boolean
): CommitPositionOffset => {
const posWithOffset = dir === 'BT' && isParallelCommits ? pos : pos + LAYOUT_OFFSET;
const branchY = branchPos.get(commit.branch)?.pos;
const x = dir === 'TB' || dir === 'BT' ? branchPos.get(commit.branch)?.pos : posWithOffset;
if (x === undefined || branchY === undefined) {
throw new Error(`Position were undefined for commit ${commit.id}`);
}
const useReduxGeometry = REDUX_GEOMETRY_THEMES.has(getConfig().theme ?? '');
const y =
dir === 'TB' || dir === 'BT'
? posWithOffset
: branchY + (useReduxGeometry ? REDUX_BRANCH_LABEL_PADDING_Y / 2 + 1 : -2);
return { x, y, posWithOffset };
};
const drawCommits = (
svg: d3.Selection<d3.BaseType, unknown, HTMLElement, any>,
commits: Map<string, Commit>,
modifyGraph: boolean,
gitGraphConfig: GitGraphDiagramConfig
) => {
const gBullets = svg.append('g').attr('class', 'commit-bullets');
const gLabels = svg.append('g').attr('class', 'commit-labels');
let pos = dir === 'TB' || dir === 'BT' ? defaultPos : 0;View on GitHub (pinned to d93e9c88c0)
When it happens
Trigger: Thrown at packages/mermaid/src/diagrams/git/gitGraphRenderer.ts:555 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mermaid-js/mermaid@d93e9c88c0 (2026-08-12).
Data as JSON: /api/errors/eaa8261e444cd09a.
Report an issue: GitHub.