{"record":{"id":"ed48864f2f6a1eb8","repo":"lerna/lerna","slug":"enopkg","errorCode":"ENOPKG","errorMessage":"Cannot diff, the package '${packageName}' does not exist.","messagePattern":"Cannot diff, the package '(.+?)' does not exist\\.","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"libs/commands/diff/src/index.ts","lineNumber":30,"sourceCode":"  pkgName?: string;\n  ignoreChanges?: string[];\n}\n\nexport class DiffCommand extends Command<DiffCommandOptions> {\n  private args: string[] = [];\n\n  override initialize() {\n    const packageName = this.options.pkgName;\n    let targetPackage;\n\n    if (packageName) {\n      const project = Object.values(this.projectGraph.nodes).find(\n        (p) => p.package && getPackage(p).name === packageName\n      );\n      targetPackage = project && getPackage(project);\n\n      if (!targetPackage) {\n        throw new ValidationError(\"ENOPKG\", `Cannot diff, the package '${packageName}' does not exist.`);\n      }\n    }\n\n    if (!hasCommit(this.execOpts)) {\n      throw new ValidationError(\"ENOCOMMITS\", \"Cannot diff, there are no commits in this repository yet.\");\n    }\n\n    const args = [\"diff\", getLastCommit(this.execOpts), \"--color=auto\"];\n\n    if (targetPackage) {\n      args.push(\"--\", targetPackage.location);\n    } else {\n      args.push(\"--\", ...this.project.packageParentDirs);\n    }\n\n    if (this.options.ignoreChanges) {\n      this.options.ignoreChanges.forEach((ignorePattern) => {\n        // https://stackoverflow.com/a/21079437","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/lerna/lerna/blob/35d15a1567932be97759f512d8b8033dad72b411/libs/commands/diff/src/index.ts#L12-L48","documentation":"Error \"Cannot diff, the package '${packageName}' does not exist.\" thrown in lerna/lerna.","triggerScenarios":"Thrown at libs/commands/diff/src/index.ts:30 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":"35d15a1567932be97759f512d8b8033dad72b411","analyzedAt":"2026-08-27T05:01:00.632Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}