facebook/react · error · Error

570

570

Error message

Invalid reference.

What it means

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.'

Source

Thrown at packages/react-server/src/ReactFlightReplyServer.js:906

          } else if (typeof value === 'bigint') {
            // Estimate the length to avoid expensive toString() calls on large
            // BigInt values. If the value is too large, we get Infinity, which
            // will trigger the array size limit error.
            // eslint-disable-next-line react-internal/no-primitive-constructors
            const n = Math.abs(Number(value));
            if (n === 0) {
              localLength = 1;
            } else {
              localLength = Math.floor(Math.log10(n)) + 1;
            }
          } else if (ArrayBuffer.isView(value)) {
            localLength = value.byteLength;
          } else {
            localLength = 0;
          }
        }
      } else {
        throw new Error('Invalid reference.');
      }
    }

    resolvedValue = map(response, value, parentObject, key);

    // Add any array counts to the reference's array root. The value that we're
    // resolving might have deep nesting that we need to resolve.
    const referenceArrayRoot = reference.arrayRoot;
    if (referenceArrayRoot !== null) {
      if (arrayRoot !== null) {
        if (arrayRoot.fork) {
          referenceArrayRoot.fork = true;
        }
        bumpArrayCount(referenceArrayRoot, arrayRoot.count, response);
      } else if (localLength > 0) {
        bumpArrayCount(referenceArrayRoot, localLength, response);
      }
    }

View on GitHub (pinned to eafeac097b)

Solutions

  1. Verify the submitting client and the server run the same React version; redeploy both together.
  2. Ensure service workers and CDNs do not serve stale action/client bundles across deploys.
  3. Treat the decode failure as a bad request: catch around decodeReply/action dispatch and return 400 instead of a 500.
  4. If it reproduces from your own UI, capture the payload and file a React issue.
Defensive patterns

Strategy: try-catch

Try / catch

import {decodeReply} from 'react-server-dom-webpack/server';
try {
  const args = await decodeReply(formData);
} catch (e) {
  // corrupt/untrusted payload - reject, never retry the same body
  return new Response('Bad request', {status: 400});
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of facebook/react@eafeac097b (2026-08-21). Data as JSON: /api/errors/9f1fe95f820091a6. Report an issue: GitHub.