{"record":{"id":"a5e86f847c7eb28c","repo":"vercel/next.js","slug":"manifest-file-is-empty","errorCode":null,"errorMessage":"Manifest file is empty","messagePattern":"Manifest file is empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"packages/next/src/server/load-manifest.external.ts","lineNumber":118,"sourceCode":"  if (shouldCache && cache.has(path)) {\n    return cache.get(path) as T\n  }\n\n  let content: any\n  if (handleMissing) {\n    try {\n      content = readFileSync(/* turbopackIgnore: true */ path, 'utf8')\n    } catch (err) {\n      let result = undefined\n      cache.set(path, result)\n      return result\n    }\n  } else {\n    content = readFileSync(/* turbopackIgnore: true */ path, 'utf8')\n  }\n\n  if (content.length === 0) {\n    throw new Error('Manifest file is empty')\n  }\n\n  let contextObject = {\n    process: { env: { NEXT_DEPLOYMENT_ID: process.env.NEXT_DEPLOYMENT_ID } },\n  }\n  runInNewContext(content, contextObject)\n\n  // Freeze the context object so it cannot be modified if we're caching it.\n  if (shouldCache) {\n    contextObject = deepFreeze(contextObject)\n  }\n\n  if (shouldCache) {\n    cache.set(path, contextObject)\n  }\n\n  return contextObject as T\n}","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/server/load-manifest.external.ts#L100-L136","documentation":"Thrown by evalManifest when a manifest file read from the build output exists but has zero bytes (content.length === 0). Manifests are generated during build; an empty one means the build artifact is corrupt, truncated, or was wiped mid-write.","triggerScenarios":"The server tries to load a manifest (e.g. routes-manifest, _buildManifest, react-loadable-manifest) from distDir and the file is present but 0 bytes. readFileSync succeeds but returns an empty string.","commonSituations":"A build was interrupted/killed leaving a partially written manifest, a deploy that copied an incomplete .next, concurrent processes writing to the same distDir, or disk full during build.","solutions":["Re-run `next build` cleanly to regenerate all manifests.","Delete the distDir (.next) entirely before rebuilding to remove any corrupt/empty files.","Ensure the build completes without being killed (check CI timeouts / OOM kills).","Verify the deployed .next directory is complete and not truncated during copy."],"exampleFix":"# before: corrupt/empty manifest from an interrupted build\nrm -rf .next && next build  # rebuild was interrupted\n\n# after: clean and complete rebuild\nrm -rf .next && next build && next start","handlingStrategy":"validation","validationCode":"import fs from 'fs'\nfunction assertManifestValid(path: string): void {\n  const stat = fs.statSync(path)\n  if (stat.size === 0) throw new Error(`Manifest ${path} is empty; rebuild`)\n}","typeGuard":"import fs from 'fs'\nfunction isManifestNonEmpty(path: string): boolean {\n  return fs.existsSync(path) && fs.statSync(path).size > 0\n}","tryCatchPattern":"null","preventionTips":["Delete distDir before building to avoid stale/empty files.","Ensure builds complete (watch for OOM/timeout kills).","Verify deployed .next is complete and not truncated."],"tags":["manifest","build","corruption","deployment"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}