{"record":{"id":"c5dec0b6e31a43e6","repo":"angular/angular-cli","slug":"unknown-file-requested-requestedpath","errorCode":null,"errorMessage":"Unknown file requested: ${requestedPath}","messagePattern":"Unknown file requested: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/build_angular/src/builders/extract-i18n/application-extraction.ts","lineNumber":117,"sourceCode":"  const fileMap = new Map(files.map((file) => [file.path, file]));\n  const textDecoder = new TextDecoder();\n  // Setup a virtual file system instance for the extractor\n  // * MessageExtractor itself uses readFile, relative and resolve\n  // * Internal SourceFileLoader (sourcemap support) uses dirname, exists, readFile, and resolve\n  const filesystem = {\n    readFile(path: string): string {\n      // Output files are stored as relative to the workspace root\n      const requestedPath = nodePath.relative(context.workspaceRoot, path);\n\n      const file = fileMap.get(requestedPath);\n      let content;\n      if (file?.origin === 'memory') {\n        content = textDecoder.decode(file.contents);\n      } else if (file?.origin === 'disk') {\n        content = readFileSync(file.inputPath, 'utf-8');\n      }\n      if (content === undefined) {\n        throw new Error('Unknown file requested: ' + requestedPath);\n      }\n\n      return content;\n    },\n    relative(from: string, to: string): string {\n      return nodePath.relative(from, to);\n    },\n    resolve(...paths: string[]): string {\n      return nodePath.resolve(...paths);\n    },\n    exists(path: string): boolean {\n      // Output files are stored as relative to the workspace root\n      const requestedPath = nodePath.relative(context.workspaceRoot, path);\n\n      return fileMap.has(requestedPath);\n    },\n    dirname(path: string): string {\n      return nodePath.dirname(path);","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/builders/extract-i18n/application-extraction.ts#L99-L135","documentation":"The extract-i18n application builder exposes a virtual filesystem-like helper `readFile` that resolves translation source files by path. Files can come from memory (in-memory build outputs, decoded via TextDecoder) or from disk (read with readFileSync). If the requested path resolves to neither and content remains undefined, it throws 'Unknown file requested' to signal that the path is not a known artifact of the extraction pipeline.","triggerScenarios":"Calling the builder's readFile helper with a path that was never produced by the application build or extraction pipeline — e.g. a stale/incorrect requestedPath, a file emitted under a different output name, or a path referencing a file excluded from the build so neither the memory-origin nor disk-origin branch supplies content.","commonSituations":"Custom scripts or plugins that consume extract-i18n internals and pass hardcoded paths; output file renamed via build options (outputPath/outputs changes) while code still requests the old name; incremental-cache corruption where a cached file record is missing its origin.","solutions":["Verify the exact path string matches the output file name produced by the application build (check outputPath/emitted files).","Ensure the file exists on disk at the expected location before extraction, or that the build actually emitted it into memory.","Clear the Angular CLI cache (ng cache clean or delete .angular/cache) to drop stale file records.","Update any custom tooling that hardcodes paths to derive the path from the builder output instead."],"exampleFix":"// before\nconst content = fs.readFile('/dist/app/browser/old-bundle.js');\n// after\nconst emitted = outputFiles.find((f) => f.path.endsWith('.js'));\nconst content = fs.readFile(emitted.path);","handlingStrategy":"validation","validationCode":"const emitted = outputFiles.find((f) => f.path === requestedPath);\nif (!emitted && !fs.existsSync(requestedPath)) {\n  throw new Error(`File not produced by build: ${requestedPath}`);\n}","typeGuard":"function isKnownArtifact(path: string, outputFiles: { path: string }[]): boolean {\n  return outputFiles.some((f) => f.path === path) || fs.existsSync(path);\n}","tryCatchPattern":"try {\n  const content = fs.readFile(requestedPath);\n} catch (e) {\n  if (e.message.startsWith('Unknown file requested')) {\n    console.warn(`Skipping unknown artifact: ${requestedPath}`);\n  } else throw e;\n}","preventionTips":["Derive file paths from builder output, never hardcode them.","Log available output paths when a lookup fails.","Clear .angular/cache when seeing stale file records.","Keep build output naming options consistent between build and extraction steps."],"tags":["extract-i18n","filesystem","angular","build"],"backgroundTag":"unknown-file-path","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}