{"record":{"id":"dc0c688b00cdb981","repo":"facebook/react","slug":"react-currently-only-supports-piping-to-one-writab-dc0c68","errorCode":null,"errorMessage":"React currently only supports piping to one writable stream.","messagePattern":"React currently only supports piping to one writable stream\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-server-dom-turbopack/src/server/ReactFlightDOMServerNode.js","lineNumber":211,"sourceCode":"    options ? options.identifierPrefix : undefined,\n    options ? options.temporaryReferences : undefined,\n    options ? options.startTime : undefined,\n    __DEV__ && options ? options.environmentName : undefined,\n    __DEV__ && options ? options.filterStackFrame : undefined,\n    debugChannelReadable !== undefined,\n  );\n  let hasStartedFlowing = false;\n  startWork(request);\n  if (debugChannelWritable !== undefined) {\n    startFlowingDebug(request, debugChannelWritable);\n  }\n  if (debugChannelReadable !== undefined) {\n    startReadingFromDebugChannelReadable(request, debugChannelReadable);\n  }\n  return {\n    pipe<T: Writable>(destination: T): T {\n      if (hasStartedFlowing) {\n        throw new Error(\n          'React currently only supports piping to one writable stream.',\n        );\n      }\n      hasStartedFlowing = true;\n      startFlowing(request, destination);\n      destination.on('drain', createDrainHandler(destination, request));\n      destination.on(\n        'error',\n        createCancelHandler(\n          request,\n          'The destination stream errored while writing data.',\n        ),\n      );\n      // We don't close until the debug channel closes.\n      if (!__DEV__ || debugChannelReadable === undefined) {\n        destination.on(\n          'close',\n          createCancelHandler(request, 'The destination stream closed early.'),","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server-dom-turbopack/src/server/ReactFlightDOMServerNode.js#L193-L229","documentation":"The turbopack server renderer's renderToPipeableStream returns a handle whose pipe() is guarded by a hasStartedFlowing flag: one Flight request can flush to exactly one Node Writable. A second pipe() call throws because the request's row stream cannot be duplicated into two destinations.","triggerScenarios":"Calling pipe() twice on one handle: piping to the HTTP response and then to a second stream (cache writer, duplicate response after retry), or piping again after a destination error.","commonSituations":"Frameworks that re-pipe after client disconnects; caching middleware trying to tee the RSC payload; SSR error recovery that swaps the destination.","solutions":["Render again with a new renderToPipeableStream call for each destination","Tee via a single PassThrough if multiple consumers need the same bytes","Buffer the render when replayability is required, then write to each destination"],"exampleFix":"// before\nconst {pipe} = renderToPipeableStream(<App />, options);\npipe(res);\npipe(cacheStream); // Error: one writable stream only\n\n// after\nconst {pipe} = renderToPipeableStream(<App />, options);\npipe(res);\nconst {pipe: pipe2} = renderToPipeableStream(<App />, options);\npipe2(cacheStream);","handlingStrategy":"validation","validationCode":"function createSinglePipeHandle(renderFn) {\n  const handle = renderFn();\n  let piped = false;\n  return {\n    pipe(destination) {\n      if (piped) throw new Error('Handle already piped; render again');\n      piped = true;\n      return handle.pipe(destination);\n    },\n  };\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never reuse a pipeable handle for a second destination","Re-render per destination or tee with PassThrough","Keep pipe() out of retry/recovery loops"],"tags":["react-server-components","turbopack","node-streams","ssr","render-to-pipeable-stream"],"backgroundTag":"stream-already-consumed","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}