{"record":{"id":"7ddb970e531740bd","repo":"angular/components","slug":"tsconfig-cannot-not-be-read-tsconfigpath","errorCode":null,"errorMessage":"Tsconfig cannot not be read: ${tsconfigPath}","messagePattern":"Tsconfig cannot not be read: (.+?)","errorType":"exception","errorClass":"TsconfigParseError","httpStatus":null,"severity":"error","filePath":"src/cdk/schematics/update-tool/utils/parse-tsconfig.ts","lineNumber":31,"sourceCode":"import {formatDiagnostics} from './diagnostics';\n\n/** Code of the error raised by TypeScript when a tsconfig doesn't match any files. */\nconst NO_INPUTS_ERROR_CODE = 18003;\n\n/** Class capturing a tsconfig parse error. */\nexport class TsconfigParseError extends Error {}\n\n/**\n * Attempts to parse the specified tsconfig file.\n *\n * @throws {TsconfigParseError} If the tsconfig could not be read or parsed.\n */\nexport function parseTsconfigFile(\n  tsconfigPath: WorkspacePath,\n  fileSystem: FileSystem,\n): ts.ParsedCommandLine {\n  if (!fileSystem.fileExists(tsconfigPath)) {\n    throw new TsconfigParseError(`Tsconfig cannot not be read: ${tsconfigPath}`);\n  }\n\n  const {config, error} = ts.readConfigFile(\n    tsconfigPath,\n    p => fileSystem.read(fileSystem.resolve(p))!,\n  );\n\n  // If there is a config reading error, we never attempt to parse the config.\n  if (error) {\n    throw new TsconfigParseError(formatDiagnostics([error], fileSystem));\n  }\n\n  const parsed = ts.parseJsonConfigFileContent(\n    config,\n    new FileSystemHost(fileSystem),\n    dirname(tsconfigPath),\n    {},\n  );","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/angular/components/blob/0411926e7d8ae06b32236ec1048a888cfad5abf2/src/cdk/schematics/update-tool/utils/parse-tsconfig.ts#L13-L49","documentation":"parseTsconfigFile throws a TsconfigParseError with this message when the given tsconfig path does not exist in the workspace FileSystem (fileExists check fails). The migration tool needs the tsconfig to build a TypeScript Program and cannot proceed without it. Note the message has a typo ('cannot not be read') but means 'cannot be read'.","triggerScenarios":"Calling parseTsconfigFile(tsconfigPath, fileSystem) where fileSystem.fileExists(tsconfigPath) returns false — i.e. the passed path points to a nonexistent file, or a directory instead of a tsconfig file.","commonSituations":"A schematic/migration was configured with a wrong tsconfig path (e.g. typos, wrong project target), the tsconfig was renamed or deleted, the migration runs on a workspace layout where the expected tsconfig (e.g. tsconfig.json at project root) doesn't exist, or the path is resolved against the wrong workspace root.","solutions":["Verify the tsconfig path passed to the migration (ng update / update-tool) exists relative to the workspace root; create or correct it.","Check for typos or an incorrect project configuration pointing at a nonexistent tsconfig.","If the project uses a non-standard layout, ensure the expected tsconfig is present or the path option is adjusted to the actual file."],"exampleFix":"// before (path doesn't exist)\nparseTsconfigFile('projects/app/tsconfig.json' as WorkspacePath, fileSystem);\n// after (ensure file exists, or guard first)\nconst path = 'tsconfig.json' as WorkspacePath;\nif (!fileSystem.fileExists(path)) {\n  throw new Error(`tsconfig missing at ${path}; check your project configuration`);\n}\nparseTsconfigFile(path, fileSystem);","handlingStrategy":"validation","validationCode":"import {existsSync} from 'fs';\nif (!existsSync(tsconfigPath)) {\n  console.error(`tsconfig not found at ${tsconfigPath}; check your --tsconfig-path option`);\n  process.exit(1);\n}","typeGuard":"function tsconfigExists(path: string, fs: FileSystem): path is WorkspacePath {\n  return fs.fileExists(path as WorkspacePath);\n}","tryCatchPattern":"try {\n  const parsed = parseTsconfigFile(path, fileSystem);\n} catch (e) {\n  if (e instanceof TsconfigParseError && /cannot not be read/.test(e.message)) {\n    console.error(`tsconfig missing: ${e.message}`);\n  } else {\n    throw e;\n  }\n}","preventionTips":["Always confirm the tsconfig path relative to the workspace root before running migrations.","Pass an explicit tsconfig path option if your workspace layout is non-standard.","Keep tsconfig.json files committed so they aren't lost between checkouts."],"tags":["typescript","tsconfig","file-not-found","configuration"],"backgroundTag":"tsconfig-not-found","analyzedSha":"0411926e7d8ae06b32236ec1048a888cfad5abf2","analyzedAt":"2026-08-31T11:58:23.400Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}