{"record":{"id":"e18c4573d9f4f4b6","repo":"vercel/next.js","slug":"could-not-parse-output-from-typescript-s-showcon","errorCode":null,"errorMessage":"Could not parse output from TypeScript's --showConfig.","messagePattern":"Could not parse output from TypeScript's --showConfig\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/lib/typescript/runTypeScriptCli.ts","lineNumber":253,"sourceCode":"  tscPath: string\n}): Promise<{ compilerOptions: Record<string, any> }> {\n  const result = await runTypeScriptCli({\n    cwd: baseDir,\n    tscPath,\n    args: ['--showConfig', '--project', tsConfigPath, '--pretty', 'false'],\n    captureOutput: true,\n  })\n\n  if (result.exitCode !== 0) {\n    throw new Error(\n      [result.stdout, result.stderr].filter(Boolean).join('\\n').trim()\n    )\n  }\n\n  try {\n    return JSON.parse(result.stdout)\n  } catch (cause) {\n    throw new Error(`Could not parse output from TypeScript's --showConfig.`, {\n      cause,\n    })\n  }\n}\n","sourceCodeStart":235,"sourceCodeEnd":258,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/lib/typescript/runTypeScriptCli.ts#L235-L258","documentation":"Thrown by getTypeScriptConfigurationCli() when `tsc --showConfig` succeeds (exit 0) but its stdout is not valid JSON and JSON.parse throws. Next.js invokes the TypeScript CLI to expand the tsconfig into a fully-resolved config; if the CLI emits unexpected output (a banner, warning, or non-JSON text), parsing fails.","triggerScenarios":"experimental.useTypeScriptCli is enabled and `tsc --showConfig --project tsconfig.json --pretty false` returns non-JSON stdout. Causes: a custom tsc wrapper printing to stdout, a TypeScript version whose --showConfig output differs, or stdout pollution from a Node.js preload/banner.","commonSituations":"Using TypeScript 7 (native preview) whose CLI output format differs; a NODE_OPTIONS preload that logs to stdout; a malformed tsconfig that makes tsc emit diagnostics to stdout instead of stderr while still exiting 0; shell wrapper aliasing tsc.","solutions":["Run `npx tsc --showConfig --project tsconfig.json --pretty false` manually and inspect stdout — it must be pure JSON.","Disable experimental.useTypeScriptCli in next.config.js to fall back to the TypeScript compiler API path.","Remove any NODE_OPTIONS preloads or banners that write to stdout.","Ensure you are using a supported TypeScript version; if on a native preview, confirm --showConfig JSON output is stable."],"exampleFix":"// before: experimental.useTypeScriptCli enabled with a tsc that pollutes stdout\n// after (next.config.js)\nmodule.exports = { experimental: { useTypeScriptCli: false } }","handlingStrategy":"try-catch","validationCode":"import { execSync } from 'child_process'\nfunction validateTscShowConfig(tscPath: string, tsConfigPath: string) {\n  const out = execSync(`node ${tscPath} --showConfig --project ${tsConfigPath} --pretty false`, { encoding: 'utf8' })\n  JSON.parse(out) // throws if not JSON\n}","typeGuard":null,"tryCatchPattern":"try {\n  const config = await getTypeScriptConfigurationCli({ baseDir, tsConfigPath, tscPath })\n} catch (err) {\n  if (err.message.includes(\"Could not parse output from TypeScript's --showConfig\")) {\n    // disable experimental.useTypeScriptCli and fall back to the API path\n  }\n  throw err\n}","preventionTips":["If you hit this, disable experimental.useTypeScriptCli.","Ensure no NODE_OPTIONS preload writes to stdout.","Pin a TypeScript version whose --showConfig emits stable JSON.","Test tsc --showConfig output manually before enabling the CLI path."],"tags":["typescript","cli","config","json","experimental"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}