vercel/next.js · error · Error

Unterminated JSON object in ${filePath}.

Error message

Unterminated JSON object in ${filePath}.

What it means

Structural parse failure in parseClientReferenceManifest: the brace-depth scanner reached end-of-file without ever closing the top-level object it opened. This means the manifest file at filePath is truncated or malformed, as opposed to containing invalid JSON inside a complete object.

Source

Thrown at packages/next/src/cli/internal/static-routes-info.ts:523

      inString = true
      quote = ch
    } else if (ch === '{') {
      depth++
    } else if (ch === '}') {
      depth--
      if (depth === 0) {
        const body = content.slice(start, i + 1)
        try {
          return JSON.parse(body)
        } catch (err) {
          throw new Error(
            `Failed to parse JSON body of ${filePath}: ${(err as Error).message}`
          )
        }
      }
    }
  }
  throw new Error(`Unterminated JSON object in ${filePath}.`)
}

/**
 * Add a chunk path to the right client-side category. Strips a `?dpl=...`
 * (or any other) query suffix that webpack appends, then dispatches by
 * extension. Returns true if the path looked like a real asset (had an
 * extension we recognize) — used by the webpack `clientModules` walker
 * below to filter out chunk IDs.
 */
function addClientChunk(rawPath: string, sets: FileSets): boolean {
  // Some manifests append `?dpl=ID` to chunk URLs.
  const cleaned = stripNextPrefix(rawPath).split('?')[0]
  if (cleaned.endsWith('.map')) sets.clientMaps.add(cleaned)
  else if (cleaned.endsWith('.css')) sets.clientCss.add(cleaned)
  else if (cleaned.endsWith('.js')) sets.clientJs.add(cleaned)
  else return false
  return true
}

View on GitHub (pinned to 0eb3775416)

Solutions

  1. The JSON file is truncated; delete the file and let Next.js regenerate it on the next build.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: A JSON object in a static routes info file is truncated or unterminated.

Common situations: The build output JSON file was partially written or corrupted on disk.


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