{"record":{"id":"eeb446139b672574","repo":"vercel/next.js","slug":"could-not-parsetsconfig-json-please-make-sure-it","errorCode":null,"errorMessage":"Could not parsetsconfig.json. Please make sure it contains syntactically correct JSON.","messagePattern":"Could not parsetsconfig\\.json\\. Please make sure it contains syntactically correct JSON\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/lib/typescript/getTypeScriptConfiguration.ts","lineNumber":63,"sourceCode":"      result.errors = result.errors.filter(\n        ({ code }) =>\n          // No inputs were found in config file\n          code !== 18003\n      )\n    }\n\n    if (result.errors?.length) {\n      // TODO: Throw AggregateError for all diagnostics.\n      throw new Error(\n        typescript.formatDiagnostic(result.errors[0], formatDiagnosticsHost)\n      )\n    }\n\n    return result\n  } catch (err) {\n    if (isError(err) && err.name === 'SyntaxError') {\n      const reason = '\\n' + (err.message ?? '')\n      throw new Error(\n        bold(\n          'Could not parse' +\n            cyan('tsconfig.json') +\n            '.' +\n            ' Please make sure it contains syntactically correct JSON.'\n        ) + reason\n      )\n    }\n    throw err\n  }\n}\n","sourceCodeStart":45,"sourceCodeEnd":75,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/lib/typescript/getTypeScriptConfiguration.ts#L45-L75","documentation":"Thrown by getTypeScriptConfiguration() when parsing tsconfig.json raises a SyntaxError, meaning the file is not valid JSON (trailing commas, comments in non-JSON5 mode, unquoted keys, etc.). Next.js reads tsconfig.json to configure TypeScript path aliases and compiler options during dev/build, so it must be syntactically valid JSON.","triggerScenarios":"tsconfig.json contains a JSON syntax error: trailing comma, single-quoted strings, unquoted property names, or a stray comment when read via typescript.readConfigFile that ultimately surfaces as a SyntaxError. The catch block at line 60 detects err.name === 'SyntaxError' and re-throws this friendly message.","commonSituations":"Hand-editing tsconfig.json and introducing a typo; copying a config snippet that uses JSON5 features; a merge conflict leaving invalid JSON; an editor auto-formatting that corrupts the file.","solutions":["Open tsconfig.json and run it through a JSON validator (e.g. `npx tsconfig.json` lint or jsonlint) to find the syntax error.","Remove trailing commas, comments, and ensure all keys/strings use double quotes.","Use `tsc --showConfig` to confirm TypeScript itself can parse the file.","If you rely on comments/extends, note tsconfig allows comments via the TS loader, but the underlying readConfigFile must still succeed — fix the specific SyntaxError shown in the message's appended reason."],"exampleFix":"// before (tsconfig.json - invalid)\n{\n  \"compilerOptions\": {\n    \"strict\": true, // trailing comment\n    \"target\": \"ES2020\",\n  }\n}\n// after\n{\n  \"compilerOptions\": {\n    \"strict\": true,\n    \"target\": \"ES2020\"\n  }\n}","handlingStrategy":"validation","validationCode":"import { readFileSync } from 'fs'\nfunction validateTsconfig(path: string) {\n  try { JSON.parse(readFileSync(path, 'utf8')) }\n  catch (e) { throw new Error(`tsconfig.json is not valid JSON: ${e.message}`) }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate tsconfig.json with a JSON linter after every edit.","Use `tsc --showConfig` to confirm TypeScript can parse it.","Avoid trailing commas and comments unless you confirm the TS loader accepts them.","Add a preinstall or lint step that checks tsconfig validity."],"tags":["typescript","config","json","build"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}