{"record":{"id":"3f6fd8aadf042a29","repo":"mermaid-js/mermaid","slug":"incorrect-usage-of-cherrypick-source-commit-id","errorCode":null,"errorMessage":"Incorrect usage of \"cherryPick\". Source commit id should exist and provided","messagePattern":"Incorrect usage of \"cherryPick\"\\. Source commit id should exist and provided","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/git/gitGraphAst.ts","lineNumber":289,"sourceCode":"  tags = tags?.map((tag) => common.sanitizeText(tag, config));\n\n  parentCommitId = common.sanitizeText(parentCommitId, config);\n\n  if (!sourceId || !state.records.commits.has(sourceId)) {\n    const error: any = new Error(\n      'Incorrect usage of \"cherryPick\". Source commit id should exist and provided'\n    );\n    error.hash = {\n      text: `cherryPick ${sourceId} ${targetId}`,\n      token: `cherryPick ${sourceId} ${targetId}`,\n      expected: ['cherry-pick abc'],\n    };\n    throw error;\n  }\n\n  const sourceCommit = state.records.commits.get(sourceId);\n  if (sourceCommit === undefined || !sourceCommit) {\n    throw new Error('Incorrect usage of \"cherryPick\". Source commit id should exist and provided');\n  }\n  if (\n    parentCommitId &&\n    !(Array.isArray(sourceCommit.parents) && sourceCommit.parents.includes(parentCommitId))\n  ) {\n    const error = new Error(\n      'Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.'\n    );\n    throw error;\n  }\n  const sourceCommitBranch = sourceCommit.branch;\n  if (sourceCommit.type === commitType.MERGE && !parentCommitId) {\n    const error = new Error(\n      'Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.'\n    );\n    throw error;\n  }\n  if (!targetId || !state.records.commits.has(targetId)) {","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/git/gitGraphAst.ts#L271-L307","documentation":"Error \"Incorrect usage of \"cherryPick\". Source commit id should exist and provided\" thrown in mermaid-js/mermaid.","triggerScenarios":"Thrown at packages/mermaid/src/diagrams/git/gitGraphAst.ts:289 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"}