{"record":{"id":"ff1b47356b9db582","repo":"facebook/react","slug":"567","errorCode":"567","errorMessage":"Already initialized stream.","messagePattern":"Already initialized stream\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-server/src/ReactFlightReplyServer.js","lineNumber":1377,"sourceCode":"        controller.close(value === 'C' ? '\"$undefined\"' : value.slice(1));\n      } else {\n        controller.enqueueModel(value);\n      }\n    }\n  }\n}\n\nfunction parseReadableStream<T>(\n  response: Response,\n  reference: string,\n  type: void | 'bytes',\n  parentObject: Object,\n  parentKey: string,\n): ReadableStream {\n  const id = parseInt(reference.slice(2), 16);\n  const chunks = response._chunks;\n  if (chunks.has(id)) {\n    throw new Error('Already initialized stream.');\n  }\n\n  let controller: ReadableStreamController = null as any;\n  let closed = false;\n  const stream = new ReadableStream({\n    type: type,\n    start(c) {\n      controller = c;\n    },\n  });\n  let previousBlockedChunk: SomeChunk<T> | null = null;\n  function enqueue(value: T): void {\n    if (type === 'bytes' && !ArrayBuffer.isView(value)) {\n      flightController.error(new Error('Invalid data for bytes stream.'));\n      return;\n    }\n    controller.enqueue(value);\n  }","sourceCodeStart":1359,"sourceCodeEnd":1395,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server/src/ReactFlightReplyServer.js#L1359-L1395","documentation":"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.","triggerScenarios":"Two stream-typed entries in the FormData share the same chunk id - duplicated fields, replayed payloads, or version-skewed encoders.","commonSituations":"Captured and replayed action submissions; request duplication by proxies or retries; mixed React builds.","solutions":["Catch the decode error and respond 400; do not retry the identical payload.","Verify React version parity on both sides of the boundary.","Make sure proxies or retry logic never duplicate multipart parts."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const args = await decodeReply(formData);\n} catch (e) {\n  return new Response('Bad request', {status: 400});\n}","preventionTips":["Reject duplicated/replayed submissions at the transport layer (idempotency keys).","Do not retry a failed action submission with the identical body.","Keep React versions in lockstep across the boundary."],"tags":["react","server-actions","deserialization","stream","readable-stream"],"backgroundTag":"malformed-serialized-payload","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}