facebook/react · error · Error

567

567

Error message

Already initialized stream.

What it means

parseReadableStream revives a serialized ReadableStream by registering a controller chunk under its id. A second stream entry with the same id means the payload re-declares a stream, and React throws rather than wiring two consumers to one controller.

Source

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

        controller.close(value === 'C' ? '"$undefined"' : value.slice(1));
      } else {
        controller.enqueueModel(value);
      }
    }
  }
}

function parseReadableStream<T>(
  response: Response,
  reference: string,
  type: void | 'bytes',
  parentObject: Object,
  parentKey: string,
): ReadableStream {
  const id = parseInt(reference.slice(2), 16);
  const chunks = response._chunks;
  if (chunks.has(id)) {
    throw new Error('Already initialized stream.');
  }

  let controller: ReadableStreamController = null as any;
  let closed = false;
  const stream = new ReadableStream({
    type: type,
    start(c) {
      controller = c;
    },
  });
  let previousBlockedChunk: SomeChunk<T> | null = null;
  function enqueue(value: T): void {
    if (type === 'bytes' && !ArrayBuffer.isView(value)) {
      flightController.error(new Error('Invalid data for bytes stream.'));
      return;
    }
    controller.enqueue(value);
  }

View on GitHub (pinned to eafeac097b)

Solutions

  1. Catch the decode error and respond 400; do not retry the identical payload.
  2. Verify React version parity on both sides of the boundary.
  3. Make sure proxies or retry logic never duplicate multipart parts.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const args = await decodeReply(formData);
} catch (e) {
  return new Response('Bad request', {status: 400});
}

Prevention

When it happens

Trigger: Two stream-typed entries in the FormData share the same chunk id - duplicated fields, replayed payloads, or version-skewed encoders.

Common situations: Captured and replayed action submissions; request duplication by proxies or retries; mixed React builds.

Related errors


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