pentaho/pentaho-kettle · error · KettleException
throw new KettleException( e );
Error message
throw new KettleException( e );
What it means
GetFilesRowsCount.getRowNumber() wraps any exception raised while scanning the currently open file to count its rows into a bare KettleException. The file is closed in the finally block, so the error means row counting for data.file failed before reaching the reported rownr.
Solutions
- Check file encoding/charset configuration matches the file.
- Verify the separator and row-count field settings align with file content.
- Ensure the file is readable by the user running the transformation.
- Inspect the wrapped cause (e) for the exact IO/parse failure.
Example fix
// before reader = new InputStreamReader(input); // platform default charset // after reader = new InputStreamReader(input, Charset.forName(meta.getEncoding() != null ? meta.getEncoding() : "UTF-8"));
Defensive patterns
Strategy: try-catch
Validate before calling
if (meta.getEncoding() != null && !Charset.isSupported(meta.getEncoding())) throw new IllegalArgumentException("Unsupported encoding: " + meta.getEncoding()); Try / catch
try { count = getRowNumber(...); } catch (KettleException e) { log.error("Row counting failed for file: " + data.file, e.getCause()); } finally { /* file is closed by the step */ } Prevention
- Set the correct charset for each file
- Ensure the separator matches the file layout
- Check file permissions for the runtime user
- Test on a small sample file first
When it happens
Trigger: Called from openNextFile when reading the file via data.fr throws: IO error, charset decoding failure, or the configured row-count field cannot be parsed from the line.
Common situations: Binary or wrongly-encoded files opened as text; permission changes mid-read; huge files hitting IO errors; count field format mismatch with the file's separator settings.
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
- Could not read file
- <toString()> : Unable to read value metadata from input…
- AccessInput.Error.ErrorReadingFile
- AvroInput.Error.ObjectReadError
- Cannot open control file
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/c3ce122b04405f08.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/getfilesrowscount/GetFilesRowsCount.java:170
prevCR = false;
}
} else {
if ( buf[i] == data.separator ) {
data.rownr++;
// Maybe we won't have data after
data.foundData = false;
}
}
}
}
}
if ( isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "GetFilesRowsCount.Log.RowsInFile", data.file.toString(), ""
+ data.rownr ) );
}
} catch ( Exception e ) {
throw new KettleException( e );
} finally {
// Close inputstream - not used except for counting
if ( data.fr != null ) {
BaseStep.closeQuietly( data.fr );
data.fr = null;
}
}
}
private boolean openNextFile() {
if ( data.last_file ) {
return false; // Done!
}
try {
if ( !meta.isFileField() ) {
if ( data.filenr >= data.files.nrOfFiles() ) {View on GitHub (pinned to f3058517a1)