pentaho/pentaho-kettle · error · KettleFileException

Exception reading line using NIO

Error message

Exception reading line using NIO

What it means

readOneRow reads and parses one CSV line via Kettle's NIO text-file reader from the S3 object stream. Any exception during reading/parsing (I/O failure, malformed encoding, conversion error) is wrapped in a KettleFileException with the literal message 'Exception reading line using NIO'.

Solutions

  1. Inspect the KettleFileException cause for the root I/O or parse error
  2. Re-check S3 connectivity / increase HTTP client timeouts for large files
  3. Verify the file encoding setting matches the actual file charset
  4. Validate delimiter, enclosure and escape settings against the file content
  5. Retry the transformation if the cause is a transient network failure
Defensive patterns

Strategy: try-catch

Validate before calling

if ( data.s3ObjectInputStream == null ) throw new IllegalStateException( "file not opened before read" );

Try / catch

try {
  RowDataAndResult row = readOneRow();
} catch ( KettleFileException e ) {
  Throwable cause = e.getCause();
  if ( cause instanceof IOException && isTransient( cause ) ) retryOrReopenFile();
  else throw e;
}

Prevention

When it happens

Trigger: The S3 object stream errors mid-read (connection reset, stream closed), the byte/charset conversion fails, or field parsing throws while processing row content.

Common situations: S3 connection dropped during long reads of large files; file contains characters incompatible with the configured encoding; delimiter/enclosure settings causing parse failures; stream already closed by an earlier closeFile call.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

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

      // Optionally add the current filename to the mix as well...
      //
      if ( meta.isIncludingFilename() && !Utils.isEmpty( meta.getFilenameField() ) ) {
        if ( meta.isLazyConversionActive() ) {
          outputRowData[outputIndex++] = data.binaryFilename;
        } else {
          outputRowData[outputIndex++] = data.filenames[data.filenr - 1];
        }
      }

      if ( data.isAddingRowNumber ) {
        outputRowData[outputIndex++] = new Long( data.rowNumber++ );
      }

      incrementLinesInput();
      return outputRowData;
    } catch ( Exception e ) {
      throw new KettleFileException( "Exception reading line using NIO", e );
    }
  }

  @Override
  public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
    meta = (S3CsvInputMeta) smi;
    data = (S3CsvInputData) sdi;

    if ( super.init( smi, sdi ) ) {

      data.preferredBufferSize = 500000; // Fixed size

      try {
        //Get the specified bucket
        String bucketname = environmentSubstitute( meta.getBucket() );
        data.s3Client = meta.getS3Client( this );
        data.s3bucket = new S3ObjectsProvider( data.s3Client ).getBucket( bucketname );
        if ( data.s3bucket == null ) {

View on GitHub (pinned to f3058517a1)