{"record":{"id":"9f1fe95f820091a6","repo":"facebook/react","slug":"570","errorCode":"570","errorMessage":"Invalid reference.","messagePattern":"Invalid reference\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-server/src/ReactFlightReplyServer.js","lineNumber":906,"sourceCode":"          } else if (typeof value === 'bigint') {\n            // Estimate the length to avoid expensive toString() calls on large\n            // BigInt values. If the value is too large, we get Infinity, which\n            // will trigger the array size limit error.\n            // eslint-disable-next-line react-internal/no-primitive-constructors\n            const n = Math.abs(Number(value));\n            if (n === 0) {\n              localLength = 1;\n            } else {\n              localLength = Math.floor(Math.log10(n)) + 1;\n            }\n          } else if (ArrayBuffer.isView(value)) {\n            localLength = value.byteLength;\n          } else {\n            localLength = 0;\n          }\n        }\n      } else {\n        throw new Error('Invalid reference.');\n      }\n    }\n\n    resolvedValue = map(response, value, parentObject, key);\n\n    // Add any array counts to the reference's array root. The value that we're\n    // resolving might have deep nesting that we need to resolve.\n    const referenceArrayRoot = reference.arrayRoot;\n    if (referenceArrayRoot !== null) {\n      if (arrayRoot !== null) {\n        if (arrayRoot.fork) {\n          referenceArrayRoot.fork = true;\n        }\n        bumpArrayCount(referenceArrayRoot, arrayRoot.count, response);\n      } else if (localLength > 0) {\n        bumpArrayCount(referenceArrayRoot, localLength, response);\n      }\n    }","sourceCodeStart":888,"sourceCodeEnd":924,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server/src/ReactFlightReplyServer.js#L888-L924","documentation":"While resolving a reply payload, React walks string references of the form id:prop:sub through an already-parsed chunk. In fulfillReference (the deferred path taken when the referenced chunk resolves later), if an intermediate value is not a plain object/array - null, a class instance, a Date - or the named property is missing, the walk cannot continue and throws 'Invalid reference.'","triggerScenarios":"The submitted FormData references a path like 12a:user:name but chunk 12a is not a plain object, or lacks that property. Produced by truncated or hand-crafted submissions, middleware that mutates the multipart body, or client/server React version skew.","commonSituations":"Bots posting fabricated fields to a server action endpoint; a stale cached client bundle submitting old-shaped references after a deploy; proxies reordering or truncating multipart parts.","solutions":["Verify the submitting client and the server run the same React version; redeploy both together.","Ensure service workers and CDNs do not serve stale action/client bundles across deploys.","Treat the decode failure as a bad request: catch around decodeReply/action dispatch and return 400 instead of a 500.","If it reproduces from your own UI, capture the payload and file a React issue."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"import {decodeReply} from 'react-server-dom-webpack/server';\ntry {\n  const args = await decodeReply(formData);\n} catch (e) {\n  // corrupt/untrusted payload - reject, never retry the same body\n  return new Response('Bad request', {status: 400});\n}","preventionTips":["Pin one React version for client and server and deploy them together.","Bust service worker and CDN caches for action/client bundles on every deploy.","Validate content-type and cap body size before decoding action submissions.","Log decode failures with a payload fingerprint to spot probing traffic."],"tags":["react","server-actions","deserialization","flight-protocol"],"backgroundTag":"malformed-serialized-payload","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}