vercel/next.js · error · Error

Could not parse tsconfig.json. Please make sure it contains

Error message

Could not parse tsconfig.json. Please make sure it contains syntactically correct JSON.
${err.message}

What it means

tsconfig.json could not even be parsed: the TypeScript config file contains syntactically invalid JSON, and the SyntaxError from parsing is wrapped with the original message appended. This is a file-correction task on the user's tsconfig, distinct from semantic TS diagnostics reported separately.

Source

Thrown at packages/next/src/lib/typescript/getTypeScriptConfiguration.ts:63

      result.errors = result.errors.filter(
        ({ code }) =>
          // No inputs were found in config file
          code !== 18003
      )
    }

    if (result.errors?.length) {
      // TODO: Throw AggregateError for all diagnostics.
      throw new Error(
        typescript.formatDiagnostic(result.errors[0], formatDiagnosticsHost)
      )
    }

    return result
  } catch (err) {
    if (isError(err) && err.name === 'SyntaxError') {
      const reason = '\n' + (err.message ?? '')
      throw new Error(
        bold(
          'Could not parse' +
            cyan('tsconfig.json') +
            '.' +
            ' Please make sure it contains syntactically correct JSON.'
        ) + reason
      )
    }
    throw err
  }
}

View on GitHub (pinned to 0eb3775416)

Solutions

  1. Fix the JSON syntax error in tsconfig.json (trailing commas, comments are allowed but must be valid JSONC).
Defensive patterns

Strategy: try-catch

When it happens

Trigger: tsconfig.json contains invalid JSON syntax.

Common situations: Trailing commas, comments, or syntax errors make tsconfig.json unparsable at startup.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/132e1ac2b3418d5b. Report an issue: GitHub.