remix-run/react-router · error · Error

${configResult.error}

Error message

${configResult.error}

What it means

Generic re-throw of a failed React Router config load inside the RSC Framework Mode plugin's config hook. The configResult comes from createConfigLoader with a validateConfig that rejects `buildEnd`, `presets`, and `serverBundles` (unsupported in RSC Framework Mode), but any other config-loading failure (parse error, invalid ssr/prepare, bad route config) surfaces here too. The interpolated message is the loader's structured error string.

Source

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

        configLoaderPromise ??= createConfigLoader({
          rootDirectory,
          mode,
          watch,
          validateConfig: (userConfig) => {
            let errors: string[] = [];
            if (userConfig.buildEnd) errors.push("buildEnd");
            if (userConfig.presets?.length) errors.push("presets");
            if (userConfig.serverBundles) errors.push("serverBundles");
            if (errors.length) {
              return `RSC Framework Mode does not currently support the following React Router config:\n${errors.map((x) => ` - ${x}`).join("\n")}\n`;
            }
          },
        });
        configLoader = await configLoaderPromise;

        const configResult = await configLoader.getConfig();
        if (!configResult.ok) throw new Error(configResult.error);
        updateConfig(configResult.value);

        if (
          viteUserConfig.base &&
          config.basename !== "/" &&
          viteCommand === "serve" &&
          !viteUserConfig.server?.middlewareMode &&
          !config.basename.startsWith(viteUserConfig.base)
        ) {
          throw new Error(
            "When using the React Router `basename` and the Vite `base` config, " +
              "the `basename` config must begin with `base` for the default " +
              "Vite dev server.",
          );
        }

        const vite = await import("vite");
        logger = vite.createLogger(viteUserConfig.logLevel, {

View on GitHub (pinned to 1fd704a7da)

Solutions

  1. Read the full interpolated message — it lists exactly which keys are unsupported (e.g. ` - serverBundles`).
  2. Remove the unsupported keys (buildEnd, presets, serverBundles) from react-router.config.ts when using RSC Framework Mode.
  3. Run `pnpm react-router typegen` / config validation to surface schema errors.
  4. If you need serverBundles/buildEnd, stay on non-RSC Framework Mode until RSC support lands.

Example fix

// react-router.config.ts
// before (RSC Framework Mode)
export default { ssr: true, serverBundles: ({ branch }) => whichBundle(branch), buildEnd: async () => {} };
// after — drop unsupported keys for RSC Framework Mode
export default { ssr: true };
Defensive patterns

Strategy: validation

Validate before calling

// before enabling RSC Framework Mode, assert config is compatible
import userConfig from './react-router.config';
const unsupported = ['buildEnd', 'presets', 'serverBundles'].filter((k) => k in (userConfig as object));
if (unsupported.length) throw new Error(`RSC Framework Mode does not support: ${unsupported.join(', ')}`);

Type guard

function isRscCompatibleConfig(c: { buildEnd?: unknown; presets?: unknown[]; serverBundles?: unknown }): boolean {
  return !c.buildEnd && !c.presets?.length && !c.serverBundles;
}

Try / catch

try { await viteBuild(); }
catch (e) {
  if (e instanceof Error && e.message.startsWith('RSC Framework Mode does not currently support')) {
    // remove the listed keys from react-router.config.ts and retry
  }
  throw e;
}

Prevention

When it happens

Trigger: RSC Framework Mode (unstable_reactRouterRSC plugin) with a react-router.config.ts that sets buildEnd, presets, or serverBundles — the validateConfig callback returns a multi-line error listing the offending keys, which becomes this thrown message. Also any other !configResult.ok from the loader.

Common situations: Migrating a Framework Mode app to RSC Framework Mode without removing serverBundles (multiple server bundles aren't supported yet). Defining buildEnd hooks or presets that the RSC pipeline can't honor. Typos or schema violations in react-router.config.ts that fail config loading.

Related errors


AI-assisted analysis of remix-run/react-router@1fd704a7da (2026-08-12). Data as JSON: /api/errors/83cbecc120b21540. Report an issue: GitHub.