remix-run/react-router · error
The `prerender`/`prerender.paths` config must be a boolean,
Error message
The `prerender`/`prerender.paths` config must be a boolean, an array of string paths, or a function returning a boolean or array of string paths.
What it means
The `prerender` config field must be a boolean, a function returning boolean/string[], an array of string paths, or an object whose `paths` field is one of those shapes. This validation runs whenever `prerender` is truthy, and anything else — a string like `"all"`, a number, an object without a valid `paths` key — returns this error before the build proceeds.
Source
Thrown at packages/react-router-dev/config/config.ts:559
...userAndPresetConfigs,
};
if (!ssr && serverBundles) {
serverBundles = undefined;
}
if (prerender) {
let isValidPrerenderPathsConfig = (p: unknown) =>
typeof p === "boolean" || typeof p === "function" || Array.isArray(p);
let isValidPrerenderConfig =
isValidPrerenderPathsConfig(prerender) ||
(typeof prerender === "object" &&
"paths" in prerender &&
isValidPrerenderPathsConfig(prerender.paths));
if (!isValidPrerenderConfig) {
return err(
"The `prerender`/`prerender.paths` config must be a boolean, an array " +
"of string paths, or a function returning a boolean or array of string paths.",
);
}
if (typeof prerender === "object" && "unstable_concurrency" in prerender) {
return err(
"The `prerender.unstable_concurrency` config field has been stabilized as `prerender.concurrency`",
);
}
let isValidConcurrencyConfig =
typeof prerender != "object" ||
!("concurrency" in prerender) ||
(typeof prerender.concurrency === "number" &&
Number.isInteger(prerender.concurrency) &&
prerender.concurrency > 0);
View on GitHub (pinned to 6beaca3952)
Solutions
- Use the boolean form for full prerendering: `prerender: true`.
- List specific paths: `prerender: ["/", "/about"]`.
- Use a function for dynamic sets: `prerender: ({ getStaticPaths }) => getStaticPaths()`.
- If using the object form, put one of those same shapes under `paths`: `prerender: { paths: ["/"] }`.
Example fix
// before
export default { prerender: "all" };
// after
export default { prerender: true };
// or
export default { prerender: { paths: ["/", "/about"] } }; Defensive patterns
Strategy: validation
Validate before calling
type PrerenderShape = boolean | (() => boolean | string[]) | string[] | { paths: boolean | (() => boolean | string[]) | string[] };
function isValidPrerender(p: unknown): p is PrerenderShape {
const ok = (v: unknown) => typeof v === "boolean" || typeof v === "function" || Array.isArray(v);
return ok(p) || (typeof p === "object" && p !== null && "paths" in p && ok((p as any).paths));
}
if (!isValidPrerender(config.prerender)) throw new Error("invalid prerender config"); Type guard
function isValidPrerender(p: unknown): p is boolean | Function | string[] | { paths: boolean | Function | string[] } {
const ok = (v: unknown) => typeof v === "boolean" || typeof v === "function" || Array.isArray(v);
return ok(p) || (typeof p === "object" && p !== null && "paths" in p && ok((p as any).paths));
} Prevention
- Type the config: `export default { prerender: true } satisfies ReactRouterConfig`.
- Remember there is no string form — full prerendering is `true`, not "all".
- When using the object form, put the list under `paths` as an array of strings.
When it happens
Trigger: Setting `prerender: "all"` (invalid; the boolean form is `prerender: true`), `prerender: 1`, `prerender: { paths: "/about" }` (string instead of array), or any other shape that fails `isValidPrerenderPathsConfig` in either the top-level or `paths` position.
Common situations: Copy-pasting config from blog posts that use a string shorthand from another framework (Next.js `dynamicParams`-style strings); migrating from an older version and guessing the API; typos like `paths:` given a single string instead of an array.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- The "serverBundles" function must only return strings contai
- The `prerender.concurrency` config must be a positive intege
- Route config in "${routeConfigFile}" is invalid.
- React Router Vite plugin not found in Vite config
- Custom Vite manifest paths are not supported
AI-assisted analysis of remix-run/react-router@6beaca3952 (2026-08-18).
Data as JSON: /api/errors/854df947b1dbb1e2.
Report an issue: GitHub.