pentaho/pentaho-kettle · warning · KettleException

Unable to close file channel for file '

Error message

Unable to close file channel for file '

What it means

closeFile closes the S3 object input stream after reading. If stream.close() throws an IOException, it is rethrown as a KettleException with the literal message 'Unable to close file channel for file ' plus the last-processed filename. It is a cleanup failure after reading, not a data error.

Solutions

  1. Check the wrapped IOException cause; if the data was fully read, treat as a non-fatal cleanup warning
  2. Ensure the stream is fully consumed or explicitly aborted before close (SDK abort() instead of relying on close for partial reads)
  3. Verify network stability / proxy keep-alive settings
  4. Upgrade the S3 SDK for more robust abort/close semantics
Defensive patterns

Strategy: try-catch

Validate before calling

if ( data.s3ObjectInputStream != null ) { /* ensure fully read or abort()ed */ }

Try / catch

try {
  closeFile();
} catch ( KettleException e ) {
  logBasic( "Non-fatal close failure on " + e.getMessage() ); // data already processed
}

Prevention

When it happens

Trigger: Calling closeFile (at end of file or step termination) when the S3ObjectInputStream close fails — e.g. connection abort during abort/drain, stream already abnormally terminated, or SDK close-time validation failing.

Common situations: Cancelling/stopping a transformation mid-file; S3 network blips at end of large reads; SDK aborting a partially consumed stream.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/211b2bd5c43422c6. Report an issue: GitHub.

Appendix: source

Thrown at plugins/s3csvinput/core/src/main/java/org/pentaho/di/trans/steps/s3csvinput/S3CsvInput.java:608

          data.totalFileSize = 0L;
        }

        return true;
      } catch ( Exception e ) {
        logError( "Unexpected error trying to verify S3 settings : ", e );
      }

    }
    return false;
  }

  public void closeFile() throws KettleException {
    try {
      if ( data.s3ObjectInputStream != null ) {
        data.s3ObjectInputStream.close();
      }
    } catch ( IOException e ) {
      throw new KettleException( "Unable to close file channel for file '" + data.filenames[data.filenr - 1], e );
    }
  }
}

View on GitHub (pinned to f3058517a1)