{"record":{"id":"86c951c337ccf335","repo":"remix-run/react-router","slug":"invalid-response-found-for-routeid-routeid","errorCode":null,"errorMessage":"Invalid response found for routeId \"${routeId}\"","messagePattern":"Invalid response found for routeId \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-router/lib/dom/ssr/single-fetch.tsx","lineNumber":761,"sourceCode":"        // Three R's of redirecting (lol Veep)\n        ...(revalidate ? { \"X-Remix-Revalidate\": \"yes\" } : null),\n        ...(reload ? { \"X-Remix-Reload-Document\": \"yes\" } : null),\n        ...(replace ? { \"X-Remix-Replace\": \"yes\" } : null),\n      },\n    });\n  }\n\n  let routeResult = result.routes[routeId];\n  if (routeResult == null) {\n    throw new SingleFetchNoResultError(\n      `No result found for routeId \"${routeId}\"`,\n    );\n  } else if (\"error\" in routeResult) {\n    throw routeResult.error;\n  } else if (\"data\" in routeResult) {\n    return routeResult.data;\n  } else {\n    throw new Error(`Invalid response found for routeId \"${routeId}\"`);\n  }\n}\n\nfunction createDeferred<T = unknown>() {\n  let resolve: (val: T) => Promise<void>;\n  let reject: (error: unknown) => Promise<void>;\n  let promise = new Promise<T>((res, rej) => {\n    resolve = async (val: T) => {\n      res(val);\n      try {\n        await promise;\n      } catch {}\n    };\n    reject = async (error?: unknown) => {\n      rej(error);\n      try {\n        await promise;\n      } catch {}","sourceCodeStart":743,"sourceCodeEnd":779,"githubUrl":"https://github.com/remix-run/react-router/blob/6beaca39526d5716c3c112ebb0782765baa5a9ce/packages/react-router/lib/dom/ssr/single-fetch.tsx#L743-L779","documentation":"After confirming a route result exists, the single-fetch client expects it to be a discriminated object with either an `error` or a `data` key. This invariant throws when the value is present but has neither shape (e.g., a bare string, number, or `{}`). It indicates the `.data` payload was produced by something other than React Router's own encoder.","triggerScenarios":"Hand-crafted or hand-edited `.data` files on statically hosted prerendered sites; a proxy/middleware that transforms the JSON-ish turbo-stream body and leaves route values in a wrong shape; server code returning raw values instead of going through the framework's single-fetch response builder; stale prerendered output from an older package version being served by a new client.","commonSituations":"Editing or generating prerendered `.data` assets in a deploy pipeline; post-processing responses in a CDN worker; version skew between the version that prerendered the files and the running client.","solutions":["Regenerate the prerendered `.data` files with the same React Router version as the client and redeploy them unmodified.","Remove any response-transforming middleware/edge worker for `.data` requests.","Inspect the failing `.data` response body in the network tab and confirm each route value is `{ data: ... }` or `{ error: ... }`.","Align server and client package versions, then hard reload."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"export function ErrorBoundary() {\n  const error = useRouteError();\n  if (error instanceof Error && /Invalid response found for routeId/.test(error.message)) {\n    return <button onClick={() => window.location.reload()}>Stale data — reload</button>;\n  }\n  throw error;\n}","preventionTips":["Never hand-edit generated .data files; regenerate them with the matching version.","Keep client and server on identical react-router versions in a deploy.","Don't transform .data response bodies in middleware or CDN workers."],"tags":["single-fetch","response-shape","invariant"],"backgroundTag":"invalid-response-payload-shape","analyzedSha":"6beaca39526d5716c3c112ebb0782765baa5a9ce","analyzedAt":"2026-08-18T18:04:14.938Z","contentChangedAt":"2026-08-18T18:04:14.938Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}