{"record":{"id":"846f31a0e2b313b6","repo":"vercel/next.js","slug":"invalid-fallback-option-fallbackfield-fallbac","errorCode":null,"errorMessage":"Invalid fallback option: ${fallbackField}. Fallback option must be a string, null, undefined, or false.","messagePattern":"Invalid fallback option: (.+?)\\. Fallback option must be a string, null, undefined, or false\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/lib/fallback.ts","lineNumber":49,"sourceCode":"/**\n * Parses the fallback field from the prerender manifest.\n *\n * @param fallbackField The fallback field from the prerender manifest.\n * @returns The fallback mode.\n */\nexport function parseFallbackField(\n  fallbackField: string | boolean | null | undefined\n): FallbackMode | undefined {\n  if (typeof fallbackField === 'string') {\n    return FallbackMode.PRERENDER\n  } else if (fallbackField === null) {\n    return FallbackMode.BLOCKING_STATIC_RENDER\n  } else if (fallbackField === false) {\n    return FallbackMode.NOT_FOUND\n  } else if (fallbackField === undefined) {\n    return undefined\n  } else {\n    throw new Error(\n      `Invalid fallback option: ${fallbackField}. Fallback option must be a string, null, undefined, or false.`\n    )\n  }\n}\n\nexport function fallbackModeToFallbackField(\n  fallback: FallbackMode,\n  page: string | undefined\n): string | false | null {\n  switch (fallback) {\n    case FallbackMode.BLOCKING_STATIC_RENDER:\n      return null\n    case FallbackMode.NOT_FOUND:\n      return false\n    case FallbackMode.PRERENDER:\n      if (!page) {\n        throw new Error(\n          `Invariant: expected a page to be provided when fallback mode is \"${fallback}\"`","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/lib/fallback.ts#L31-L67","documentation":"Thrown by parseFallbackField() when the fallback field from the prerender manifest is not one of the allowed types: string, null, undefined, or false. Any other value (notably boolean true, a number, or an object) is rejected because the FallbackMode enum cannot represent it. This indicates the manifest was written incorrectly, typically by a malformed getStaticPaths fallback.","triggerScenarios":"Triggered when reading the prerender manifest's fallback field for a dynamic Pages Router route during request handling. A corrupted manifest or a getStaticPaths returning an unsupported fallback value lands here. The field is expected to be the string page path (PRERENDER), null (blocking), false (not-found), or undefined.","commonSituations":"Manually editing the prerender manifest; a custom cache handler that rewrites the manifest incorrectly; an old Next.js manifest format loaded by a newer Next.js version; or a getStaticPaths returning fallback: true in a code path that bypassed parseStaticPathsResult normalization.","solutions":["Delete the .next directory and rebuild so the prerender manifest is regenerated correctly.","Audit any custom cache handler or build plugin that mutates the prerender manifest's fallback field.","Confirm getStaticPaths returns a supported fallback value: true, 'blocking', or false (the framework normalizes these).","Verify Next.js version consistency across build and runtime (a stale .next from a different version can carry the wrong shape)."],"exampleFix":"// before — manual manifest edit produced fallback: 1\n// .next/prerender-manifest.json\n{ \"routes\": { \"/[slug]\": { \"fallback\": 1 } } }\n// after — delete stale build and rebuild\n// rm -rf .next && pnpm build","handlingStrategy":"validation","validationCode":"function isValidFallback(v: unknown): v is string | null | undefined | false {\n  return v === null || v === undefined || v === false || typeof v === 'string'\n}\n// validate the manifest before relying on it\nif (!isValidFallback(manifest.routes['/[slug]'].fallback)) {\n  throw new Error('prerender manifest has invalid fallback field')\n}","typeGuard":"function isValidFallback(v: unknown): v is string | null | undefined | false {\n  return v === null || v === undefined || v === false || typeof v === 'string'\n}","tryCatchPattern":null,"preventionTips":["Treat .next as ephemeral — delete and rebuild rather than editing manifests by hand.","Ensure getStaticPaths returns true | 'blocking' | false only.","Keep build and runtime Next.js versions identical to avoid manifest shape drift.","Audit custom cache handlers that mutate the prerender manifest."],"tags":["prerender","manifest","dynamic-routes","build"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}