{"record":{"id":"161c04d53ca77e7c","repo":"pentaho/pentaho-kettle","slug":"could-not-connect-to-pipedinputstream","errorCode":null,"errorMessage":"could not connect to pipedInputStream","messagePattern":"could not connect to pipedInputStream","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"plugins/s3-vfs/core/src/main/java/org/pentaho/s3common/S3CommonPipedOutputStream.java","lineNumber":80,"sourceCode":"  private String bucketId;\n  private String key;\n  /**\n   * AWS Multipart part size.\n   */\n  private int partSize;\n\n  public S3CommonPipedOutputStream( S3CommonFileSystem fileSystem, String bucketId, String key ) throws IOException {\n    this( fileSystem, bucketId, key, DEFAULT_PART_SIZE );\n  }\n\n  public S3CommonPipedOutputStream( S3CommonFileSystem fileSystem, String bucketId, String key, int partSize ) throws IOException {\n    this.pipedInputStream = new PipedInputStream();\n\n    try {\n      this.pipedInputStream.connect( this );\n    } catch ( IOException e ) {\n      // FATAL, unexpected\n      throw new IOException( \"could not connect to pipedInputStream\", e );\n    }\n\n    this.s3AsyncTransferRunner = new S3AsyncTransferRunner();\n    this.bucketId = bucketId;\n    this.key = key;\n    this.fileSystem = fileSystem;\n    this.partSize = partSize;\n  }\n\n  private void initializeWrite() {\n    if ( !initialized ) {\n      initialized = true;\n      result = this.executor.submit( s3AsyncTransferRunner );\n    }\n  }\n\n  public boolean isBlockedUntilDone() {\n    return blockedUntilDone;","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/s3-vfs/core/src/main/java/org/pentaho/s3common/S3CommonPipedOutputStream.java#L62-L98","documentation":"Thrown in the S3CommonPipedOutputStream constructor when PipedInputStream.connect() fails. This is marked FATAL/unexpected: a fresh PipedInputStream connected to itself in the same thread should never throw, so this signals a JVM-level internal problem.","triggerScenarios":"Constructing S3CommonPipedOutputStream; PipedInputStream.connect(this) throws IOException (only possible if the pipe is already connected to another reader, i.e. an internal invariant violation).","commonSituations":"Extremely rare; could appear if code is refactored to reuse/reconnect a shared piped stream, or with custom subclassing that pre-connects the stream.","solutions":["Never reuse or share the PipedInputStream created inside this constructor","Construct a new S3CommonPipedOutputStream per upload instead of reconnecting an existing one","Inspect the wrapped IOException; if it says 'Already connected', find the code path reusing the stream","Check for custom subclasses overriding stream state"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  S3CommonPipedOutputStream out = new S3CommonPipedOutputStream( bucketId, key, fileSystem );\n} catch ( IOException e ) {\n  throw new IllegalStateException( \"pipewire init failed (should be impossible): \" + e.getMessage(), e );\n}","preventionTips":["Never reuse or share the internal PipedInputStream across instances","Create a fresh S3CommonPipedOutputStream per upload","Avoid subclassing that pre-connects or reassigns pipedInputStream","Log the full stack trace — this signals an internal invariant breach, not user error"],"tags":["io","piped-stream","s3","upload"],"backgroundTag":"broken-pipe","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}