pentaho/pentaho-kettle · error · KettleFileException

Exception reading line using NIO

Error message

Exception reading line using NIO

What it means

readOneRow catches KettleConversionException (rethrown as-is) and any IOException, wrapping it in a KettleFileException with the fixed message 'Exception reading line using NIO'. This indicates a low-level I/O failure while reading/decoding bytes from the memory-mapped/channel buffer during row parsing, not a data conversion problem.

Solutions

  1. Check the cause chain of the KettleFileException for the real IOException and address it (disk, permissions, truncation).
  2. Ensure no other process rewrites/deletes the file during the run; copy to a staging location first.
  3. Re-run the transformation to rule out a transient I/O error.
  4. If reading from a network drive, copy the file locally before processing.
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure the file is stable and readable before reading rows
java.io.File f = new java.io.File(filename);
if (!f.canRead() || !f.isFile()) throw new IllegalStateException("Unreadable: " + filename);

Try / catch

try { ... } catch (KettleFileException e) {
  logError("NIO read failure on CSV line; cause=" + e.getCause(), e);
  setErrors(1);
}

Prevention

When it happens

Trigger: IOException thrown during buffer reads in readOneRow: file truncated/changed while being read, disk I/O error, or decode errors surfacing as IOException from the NIO channel path in outputRowData or openNextFile.

Common situations: File being overwritten or rotated while the transformation reads it; disk errors; reading a file on an unstable network mount (mapped locally); antivirus locking the file mid-read.

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/08ff17604c2a72bd. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/csvinput/CsvInput.java:860

      }

      if ( !ignoreEnclosures ) {
        incrementLinesInput();
      }

      if ( conversionExceptions != null && conversionExceptions.size() > 0 ) {
        // Forward the first exception
        //
        throw new KettleConversionException(
          "There were " + conversionExceptions.size() + " conversion errors on line " + getLinesInput(),
          conversionExceptions, exceptionFields, outputRowData );
      }

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


  public boolean init( StepMetaInterface smi, StepDataInterface sdi ) {
    meta = (CsvInputMeta) smi;
    data = (CsvInputData) sdi;

    if ( super.init( smi, sdi ) ) {
      // PDI-10242 see if a variable is used as encoding value
      String realEncoding = environmentSubstitute( meta.getEncoding() );
      data.preferredBufferSize = Integer.parseInt( environmentSubstitute( meta.getBufferSize() ) );

      // If the step doesn't have any previous steps, we just get the filename.
      // Otherwise, we'll grab the list of file names later...
      //
      if ( getTransMeta().findNrPrevSteps( getStepMeta() ) == 0 ) {

View on GitHub (pinned to f3058517a1)