{"record":{"id":"4033b5b4ce67b43f","repo":"remix-run/react-router","slug":"unable-to-decode-rsc-response","errorCode":null,"errorMessage":"Unable to decode RSC response","messagePattern":"Unable to decode RSC response","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-router/lib/rsc/browser.tsx","lineNumber":650,"sourceCode":"      const dataKey = isMutationMethod(request.method)\n        ? \"actionData\"\n        : \"loaderData\";\n      for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {\n        results.routes[routeId] = { data };\n      }\n      if (payload.errors) {\n        for (let [routeId, error] of Object.entries(payload.errors)) {\n          results.routes[routeId] = { error };\n        }\n      }\n      return { status: res.status, data: results };\n    } catch (cause) {\n      // Can't clone after consuming the body via decode so we can't include the\n      // body here.  In an ideal world we'd look for an RSC  content type here,\n      // or even X-Remix-Response but then folks can't statically deploy their\n      // prerendered .rsc files to a CDN unless they can tell that CDN to add\n      // special headers to those certain files - which is a bit restrictive.\n      throw new Error(\"Unable to decode RSC response\", { cause });\n    }\n  };\n}\n\n/**\n * Props for the {@link unstable_RSCHydratedRouter} component.\n *\n * @name unstable_RSCHydratedRouterProps\n * @category Types\n */\nexport interface RSCHydratedRouterProps {\n  /**\n   * Your `react-server-dom-xyz/client`'s `createFromReadableStream` function,\n   * used to decode payloads from the server.\n   */\n  createFromReadableStream: BrowserCreateFromReadableStreamFunction;\n  /**\n   * Optional fetch implementation. Defaults to global [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/fetch).","sourceCodeStart":632,"sourceCodeEnd":668,"githubUrl":"https://github.com/remix-run/react-router/blob/7aea711dd1ae2bc5a076d13ff17291829690fa74/packages/react-router/lib/rsc/browser.tsx#L632-L668","documentation":"This is the RSC counterpart of the single-fetch decode error: responses for navigations/actions are decoded with `createFromReadableStream`, and any failure during decode lands in this catch, which throws a bare `Error(\"Unable to decode RSC response\", { cause })` because the consumed body cannot be cloned for diagnostics. The original failure is preserved in `cause`. The bytes received were simply not a decodable RSC stream.","triggerScenarios":"HTML error pages (404/500/login) returned where an RSC stream was expected; compression or encoding corruption by proxies; partial/truncated responses from dropped connections; React server/client serialization version mismatch after upgrades where old clients decode new streams.","commonSituations":"Auth gateways intercepting `.rsc` requests; aggressive CDN transformations (minify/compress on-the-fly); flaky mobile connections truncating streams; upgrading @vitejs/plugin-rsc or react versions while browsers hold cached old bundles.","solutions":["Inspect the failing request's raw response in the network tab; if it's HTML or empty, fix the layer that produced it (proxy, auth, 404 handler) to pass RSC requests through.","Disable content transformation/compression for RSC responses at your CDN/proxy.","After upgrading React Router / plugin-rsc, redeploy and hard reload so encoder and decoder versions match.","Read `error.cause` in your error boundary logging to capture the underlying decode failure."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"export function ErrorBoundary() {\n  const error = useRouteError();\n  if (error instanceof Error && /decode RSC response/i.test(error.message)) {\n    // log the underlying cause, then recover with a full reload\n    console.error(error.cause);\n    return <button onClick={() => window.location.reload()}>Reload</button>;\n  }\n  throw error;\n}","preventionTips":["Disable CDN content transformation (minification, recompression) for RSC streams.","Let proxies pass .rsc and action requests through unmodified.","Deploy matching encoder/decoder versions and force reload old tabs."],"tags":["rsc","decoding","network","cdn"],"backgroundTag":"response-decoding-failed","analyzedSha":"7aea711dd1ae2bc5a076d13ff17291829690fa74","analyzedAt":"2026-08-18T18:04:14.938Z","contentChangedAt":"2026-08-18T18:04:14.938Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}