mermaid-js/mermaid · error · Error
Incorrect usage of "cherryPick". Source commit id should exi
Error message
Incorrect usage of "cherryPick". Source commit id should exist and provided
What it means
Error "Incorrect usage of "cherryPick". Source commit id should exist and provided" thrown in mermaid-js/mermaid.
Source
Thrown at packages/mermaid/src/diagrams/git/gitGraphAst.ts:289
tags = tags?.map((tag) => common.sanitizeText(tag, config));
parentCommitId = common.sanitizeText(parentCommitId, config);
if (!sourceId || !state.records.commits.has(sourceId)) {
const error: any = new Error(
'Incorrect usage of "cherryPick". Source commit id should exist and provided'
);
error.hash = {
text: `cherryPick ${sourceId} ${targetId}`,
token: `cherryPick ${sourceId} ${targetId}`,
expected: ['cherry-pick abc'],
};
throw error;
}
const sourceCommit = state.records.commits.get(sourceId);
if (sourceCommit === undefined || !sourceCommit) {
throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
}
if (
parentCommitId &&
!(Array.isArray(sourceCommit.parents) && sourceCommit.parents.includes(parentCommitId))
) {
const error = new Error(
'Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.'
);
throw error;
}
const sourceCommitBranch = sourceCommit.branch;
if (sourceCommit.type === commitType.MERGE && !parentCommitId) {
const error = new Error(
'Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.'
);
throw error;
}
if (!targetId || !state.records.commits.has(targetId)) {View on GitHub (pinned to d93e9c88c0)
When it happens
Trigger: Thrown at packages/mermaid/src/diagrams/git/gitGraphAst.ts:289 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/3f6fd8aadf042a29.
Report an issue: GitHub.