{"record":{"id":"dc53e0e2c98efd9e","repo":"angular/angular-cli","slug":"path-path-does-not-exist","errorCode":null,"errorMessage":"Path \"${path}\" does not exist.","messagePattern":"Path \"(.+?)\" does not exist\\.","errorType":"exception","errorClass":"FileDoesNotExistException","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/schematics/src/sink/sink.ts","lineNumber":59,"sourceCode":"    Noop;\n  postCommitAction: (action: Action) => void | Observable<void> = Noop;\n  preCommit: () => void | Observable<void> = Noop;\n  postCommit: () => void | Observable<void> = Noop;\n\n  protected abstract _validateFileExists(p: string): Observable<boolean>;\n\n  protected abstract _overwriteFile(path: string, content: Buffer): Observable<void>;\n  protected abstract _createFile(path: string, content: Buffer): Observable<void>;\n  protected abstract _renameFile(path: string, to: string): Observable<void>;\n  protected abstract _deleteFile(path: string): Observable<void>;\n\n  protected abstract _done(): Observable<void>;\n\n  protected _fileAlreadyExistException(path: string): void {\n    throw new FileAlreadyExistException(path);\n  }\n  protected _fileDoesNotExistException(path: string): void {\n    throw new FileDoesNotExistException(path);\n  }\n\n  protected _validateOverwriteAction(action: OverwriteFileAction): Observable<void> {\n    return this._validateFileExists(action.path).pipe(\n      map((b) => {\n        if (!b) {\n          this._fileDoesNotExistException(action.path);\n        }\n      }),\n    );\n  }\n  protected _validateCreateAction(action: CreateFileAction): Observable<void> {\n    return this._validateFileExists(action.path).pipe(\n      map((b) => {\n        if (b) {\n          this._fileAlreadyExistException(action.path);\n        }\n      }),","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/schematics/src/sink/sink.ts#L41-L77","documentation":"FileDoesNotExistException is thrown by Sink validation (via _fileDoesNotExistException) when an Overwrite, Rename, or Delete action targets a path that does not exist. The sink validates every action against the underlying filesystem before committing, so mutating a missing file fails instead of silently no-oping.","triggerScenarios":"host.commitSingleAction() or commit() with an 'o' (overwrite), 'r' (rename), or 'd' (delete) action whose path is absent from the sink's filesystem; calling sink-level overwrite/rename/delete on a non-existent file.","commonSituations":"A schematic assumes a file exists (e.g. overwriting src/app/app.component.ts) but the project layout differs (standalone apps, different naming, newer CLI versions); deleting a file that a prior step already removed; renaming after a conditional step skipped creation.","solutions":["Guard with tree.exists(path) before overwrite/rename/delete and branch accordingly.","Use tree.create() instead of overwrite when the file may legitimately be missing.","Fix path assumptions: derive paths from project config rather than hardcoding, or update the schematic for newer Angular layouts."],"exampleFix":"// before\ntree.overwrite('src/app/app.module.ts', newContent);\n// after\nconst modulePath = '/src/app/app.module.ts';\nif (tree.exists(modulePath)) {\n  tree.overwrite(modulePath, newContent);\n}","handlingStrategy":"validation","validationCode":"const required = ['/src/app/app.module.ts'];\nconst missing = required.filter((p) => !tree.exists(p));\nif (missing.length) throw new SchematicsException(`Missing: ${missing.join(', ')}`);","typeGuard":"null","tryCatchPattern":"try { host.commit(tree); } catch (e) { if (e instanceof FileDoesNotExistException) { logger.warn(`Skipped missing file: ${e.message}`); } else { throw e; } }","preventionTips":["Check tree.exists() before overwrite/rename/delete","Derive paths from workspace/project config instead of hardcoding","Account for newer Angular layouts (standalone, no app.module.ts)"],"tags":["schematics","file-not-found","overwrite-action"],"backgroundTag":"file-does-not-exist","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}