{"record":{"id":"b99e735f9d4951bf","repo":"facebook/react","slug":"invalid-reference","errorCode":null,"errorMessage":"Invalid reference.","messagePattern":"Invalid reference\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-client/src/ReactFlightClient.js","lineNumber":1715,"sourceCode":"              rejectReference(\n                response,\n                reference.handler,\n                referencedChunk.reason,\n              );\n              return;\n            }\n          }\n        }\n      }\n      const name = path[i];\n      if (\n        typeof value === 'object' &&\n        value !== null &&\n        hasOwnProperty.call(value, name)\n      ) {\n        value = value[name];\n      } else {\n        throw new Error('Invalid reference.');\n      }\n    }\n\n    while (\n      typeof value === 'object' &&\n      value !== null &&\n      value.$$typeof === REACT_LAZY_TYPE\n    ) {\n      // If what we're referencing is a Lazy it must be because we inserted one as a virtual node\n      // while it was blocked by other data. If it's no longer blocked, we can unwrap it.\n      const referencedChunk: SomeChunk<any> = value._payload;\n      if (referencedChunk === handler.chunk) {\n        // This is a reference to the thing we're currently blocking. We can peak\n        // inside of it to get the value.\n        value = handler.value;\n        continue;\n      } else {\n        switch (referencedChunk.status) {","sourceCodeStart":1697,"sourceCodeEnd":1733,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-client/src/ReactFlightClient.js#L1697-L1733","documentation":"While parsing an RSC/Flight payload, inline references are written as $<id>.<path>.<to>.<field>. The client resolves them by walking that path over the already-parsed chunk with id. If at any step the current value is not an object that owns the next key in the path (a primitive, missing property, null), the walk cannot continue and the client throws 'Invalid reference.' - the payload's reference points somewhere that does not exist.","triggerScenarios":"The server serialized $1.user.name but the model for $1 has no 'user' key, or 'user' resolved to a primitive; payloads produced by mismatched react-server-dom versions on either side; a Flight stream truncated or rewritten by a proxy so an out-of-order reference arrives pointing at a different shape; hand-crafted or mutated rows in custom transports.","commonSituations":"Deploying server and client bundles from different builds (version skew) so row shapes differ; middleware/CDN transformations corrupting the stream; custom servers that cache or stitch RSC payloads incorrectly; a desync between what the server exported and what a reference path assumes.","solutions":["Make react, react-dom, and react-server-dom-* package versions match exactly on server and client, and deploy both from the same build","Log the raw Flight rows around the failure (tee the stream) to find the $id.path that cannot resolve, then check what the server actually emitted for that id","If you emit custom references, verify the referenced object really contains each key in the path at serialization time","Rule out stream corruption: bypass proxies/edge transforms, disable payload caching, and retry a fresh request"],"exampleFix":"// before: server and client resolved different builds\n// package.json (web): react-server-dom-webpack@canary-a\n// package.json (server): react-server-dom-webpack@canary-b\n\n// after: single source of truth\n// package.json (workspace root): react-server-dom-webpack pinned to one exact canary,\n// consumed by both server and client builds in the same CI artifact","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const root = await createFromFetch(fetch(url, {headers: {accept: 'text/x-component'}}));\n} catch (e) {\n  if (e instanceof Error && e.message === 'Invalid reference.') {\n    // Corrupt or version-skewed RSC payload: verify server/client React versions,\n    // bust caches, and refetch a fresh payload rather than retrying blindly\n    await refetchFreshPayload();\n  } else throw e;\n}","preventionTips":["Deploy server and client from one atomic build so Flight row shapes always match","Pin identical react/react-dom/react-server-dom-* versions across the app","Never let proxies or caches rewrite Flight payload bodies","Log stream rows in dev transports so broken $ref paths are findable"],"tags":["rsc","flight","serialization","streaming","version-mismatch"],"backgroundTag":"invalid-rsc-reference","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}