{"record":{"id":"7df95e6a26f9771f","repo":"withastro/astro","slug":"specified-tsconfig-file-tsconfig-does-not-exi","errorCode":null,"errorMessage":"Specified tsconfig file `${tsconfig}` does not exist.","messagePattern":"Specified tsconfig file `(.+?)` does not exist\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/language-tools/language-server/src/check.ts","lineNumber":222,"sourceCode":"\t * `Cannot read properties of undefined` error. Fail early with an actionable message.\n\t */\n\tprivate assertCompatibleTypeScript() {\n\t\tif (typeof this.ts.findConfigFile !== 'function' || this.ts.sys === undefined) {\n\t\t\tconst version = this.ts.version ? ` (found ${this.ts.version})` : '';\n\t\t\tthrow new Error(\n\t\t\t\t`The TypeScript module loaded${version} does not expose the programmatic API that \\`astro check\\` relies on. ` +\n\t\t\t\t\t`TypeScript's native compiler (7.0 and later) does not ship this API yet. ` +\n\t\t\t\t\t`Until it does, run \\`astro check\\` with a TypeScript version that still provides it (6.x). ` +\n\t\t\t\t\t`See https://github.com/withastro/roadmap/discussions/1321 to track support.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate getTsconfig() {\n\t\tif (this.tsconfigPath) {\n\t\t\tconst tsconfig = resolve(this.workspacePath, this.tsconfigPath.replace(/^~/, homedir()));\n\t\t\tif (!existsSync(tsconfig)) {\n\t\t\t\tthrow new Error(`Specified tsconfig file \\`${tsconfig}\\` does not exist.`);\n\t\t\t}\n\t\t\treturn tsconfig;\n\t\t}\n\n\t\tconst searchPath = this.workspacePath;\n\n\t\tconst tsconfig =\n\t\t\tthis.ts.findConfigFile(searchPath, this.ts.sys.fileExists) ||\n\t\t\tthis.ts.findConfigFile(searchPath, this.ts.sys.fileExists, 'jsconfig.json');\n\n\t\treturn tsconfig;\n\t}\n}\n","sourceCodeStart":204,"sourceCodeEnd":236,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/language-tools/language-server/src/check.ts#L204-L236","documentation":"Thrown by the Astro language server's `getTsconfig()` when a tsconfig path was explicitly specified (`tsconfigPath` option) but the resolved file does not exist on disk. The checker refuses to proceed with a missing config because type resolution would be unreliable.","triggerScenarios":"Passing `tsconfig: '~/tsconfig.custom.json'` (or any path) where no file exists. The `~` expands to the home directory; a relative path resolves against `workspacePath`. Deleting/renaming a tsconfig after referencing it.","commonSituations":"Pointing `tsconfig` at a path from an old project layout. A monorepo where the tsconfig moved. A typo in the configured path.","solutions":["Verify the file exists at the resolved path printed in the error.","Omit the explicit `tsconfigPath` to let the language server auto-discover `tsconfig.json`/`jsconfig.json`.","Fix the path or recreate the missing tsconfig file."],"exampleFix":"// before: tsconfigPath points at a non-existent file\ncheck({ tsconfigPath: '~/tsconfig.build.json' })\n// after: use the workspace tsconfig.json (auto-discovered)\ncheck({})","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nif (tsconfigPath && !existsSync(resolve(workspacePath, tsconfigPath.replace(/^~/, homedir())))) {\n  throw new Error(`tsconfig not found at ${tsconfigPath}; falling back to auto-discovery.`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit `tsconfigPath` to use auto-discovery unless you need a specific file.","Re-check the path after moving tsconfig files.","Validate path existence before passing to the checker."],"tags":["language-tools","typescript","tsconfig","filesystem","config"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}