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
- Check the cause chain of the KettleFileException for the real IOException and address it (disk, permissions, truncation).
- Ensure no other process rewrites/deletes the file during the run; copy to a staging location first.
- Re-run the transformation to rule out a transient I/O error.
- 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
- Copy files to local disk before processing instead of reading from network mounts
- Avoid writing/rotating the file while the transformation reads it
- Exclude data directories from antivirus scanning during runs
- Check the cause chain for the real IOException
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
- CsvInput.Exception.CreateFieldMappingError
- CsvInput.Log.OnlyLocalFilesAreSupported
- e (no own message; error opening CSV file)
- throw new KettleException( e );
- Unable to close file channel for file '" + filenames[filenr…
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)