remix-run/react-router · warning

⚠️ Paths with dynamic/splat params cannot be prerendered whe

Error message

⚠️ Paths with dynamic/splat params cannot be prerendered when using `prerender: true`. You may want to use the `prerender()` API to prerender the following paths:

What it means

When `prerender: true`, getStaticPrerenderPaths can only enumerate static path segments; routes containing :dynamic params or splats (*) need concrete values that don't exist at build time, so those paths are skipped. This warning (only when logWarning && !ssr, i.e., SPA/prerender-only output) lists the skipped paramRoutes and points you to the `prerender()` API or explicit path arrays that can supply real values.

Source

Thrown at packages/react-router-dev/vite/plugin.ts:3016

  let pathsConfig: PrerenderPaths;

  if (typeof prerender === "object" && "paths" in prerender) {
    pathsConfig = prerender.paths;
  } else {
    pathsConfig = prerender;
  }

  if (pathsConfig === false) {
    return [];
  }

  let prerenderRoutes = createPrerenderRoutes(routes);

  if (pathsConfig === true) {
    let { paths, paramRoutes } = getStaticPrerenderPaths(prerenderRoutes);
    if (logWarning && !ssr && paramRoutes.length > 0) {
      console.warn(
        colors.yellow(
          [
            "⚠️ Paths with dynamic/splat params cannot be prerendered when " +
              "using `prerender: true`. You may want to use the `prerender()` " +
              "API to prerender the following paths:",
            ...paramRoutes.map((p) => "  - " + p),
          ].join("\n"),
        ),
      );
    }
    return paths;
  }

  if (typeof pathsConfig === "function") {
    let paths = await pathsConfig({
      getStaticPaths: () => getStaticPrerenderPaths(prerenderRoutes).paths,
    });
    return paths;

View on GitHub (pinned to 6beaca3952)

Solutions

  1. Replace the boolean with the `prerender` function (exported from "@react-router/dev") and enumerate concrete paths from your data source (CMS/DB/filesystem glob)
  2. Or supply an explicit array of fully-resolved paths: `prerender: ["/blog/hello-world", "/blog/another"]`
  3. Or keep `prerender: true` and accept that param routes are simply not prerendered — they 404/CSR at runtime in SPA mode unless covered another way

Example fix

// before - react-router.config.ts
export default { prerender: true } satisfies Config;

// after
import { prerender } from "@react-router/dev";
export default {
  async prerender({ getStaticPaths }) {
    let slugs = await getSlugsFromCMS(); // e.g. ["hello-world", "another"]
    return slugs.map((s) => `/blog/${s}`);
  },
} satisfies Config;
Defensive patterns

Strategy: validation

Validate before calling

// detect param/splat routes before choosing `prerender: true`
import { flatRoutes } from "@react-router/fs-routes";
let routes = await flatRoutes()();
let paramRoutes = routes.filter((r) => /[:*]/.test(r.path ?? ""));
if (paramRoutes.length && !ssr) {
  console.warn(`Use prerender() with concrete paths for: ${paramRoutes.map((r) => r.path).join(", ")}`);
}

Prevention

When it happens

Trigger: `prerender: true` in react-router.config.ts combined with route files like `blog.$slug.tsx`, `products.$id.tsx`, or `files.$.ts`, when building without SSR (SPA mode).

Common situations: Blogs, docs sites, and e-commerce catalogs wanting static output for param routes; enabling `prerender: true` as a blanket setting without enumerating slugs.

Related errors


AI-assisted analysis of remix-run/react-router@6beaca3952 (2026-08-18). Data as JSON: /api/errors/3e474af194ad9cb3. Report an issue: GitHub.