pentaho/pentaho-kettle · error · RuntimeException
RuntimeException( e )
Error message
RuntimeException( e )
What it means
While streaming the sheet XML in getRow(), any Exception (typically XMLStreamException, IOException after a reader reset, or NumberFormatException on malformed 'r' attributes) is wrapped in a plain RuntimeException. It signals the underlying XLSX part could not be parsed while locating the requested row.
Solutions
- Validate/repair the xlsx file (open it in Excel or re-export it)
- Unwrap the cause (getCause()) to see the underlying XMLStreamException/IOException
- Read rows sequentially instead of random access to avoid resetSheetReader()
- Catch RuntimeException around getRow and treat the file as unreadable
Example fix
// before
KCell[] cells = sheet.getRow(i); // RuntimeException escapes
// after
try {
KCell[] cells = sheet.getRow(i);
} catch (RuntimeException e) {
throw new KettleException("Failed reading sheet row " + i, e.getCause());
} Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-validate the file is a readable zip (xlsx) before streaming
try (ZipFile zf = new ZipFile(file)) { if (zf.getEntry("xl/workbook.xml") == null) throw new KettleException("Not an xlsx"); } Try / catch
try {
KCell[] cells = sheet.getRow(rownr);
} catch (RuntimeException e) {
throw new KettleException("Sheet read failed", e.getCause());
} Prevention
- Read rows sequentially; avoid random-access getRow on large sheets
- Validate the xlsx file before processing
- Prefer ZipSecureFile-hardened POI versions and keep POI updated
When it happens
Trigger: Calling getRow()/cell() on a StaxPoiSheet whose sheetReader fails mid-stream: corrupted xlsx sheet XML, stream closed/reset failure (resetSheetReader), or invalid row numbers in the document.
Common situations: Reading truncated or corrupted .xlsx files; files produced by non-Excel tools with missing/invalid row 'r' attributes; random-access getRow() calls that force a reader reset on a broken stream.
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
- DBProcMeta.Exception.UnableToReadStepInfo
- MergeJoinMeta.Exception.UnableToLoadStepInfo
- MergeRowsMeta.Exception.UnableToLoadStepInfo
- PGPEncryptStreamMeta.Exception.UnableToReadStepInfo
- Template Format Mismatch: Template has extension: " +…
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/ea0759489ac869e8.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/excel/core/src/main/java/org/pentaho/di/trans/steps/excelinput/staxpoi/StaxPoiSheet.java:236
}
while ( sheetReader.hasNext() ) {
int event = sheetReader.next();
if ( event == XMLStreamConstants.START_ELEMENT && sheetReader.getLocalName().equals( TAG_ROW ) ) {
String rowIndicator = sheetReader.getAttributeValue( null, "r" );
currentRow = Integer.parseInt( rowIndicator );
if ( currentRow < rownr + 1 ) {
continue;
}
currentRowCells = parseRow();
return currentRowCells;
}
if ( event == XMLStreamConstants.END_ELEMENT && sheetReader.getLocalName().equals( TAG_SHEET_DATA ) ) {
// There're no more columns, no need to continue to read
break;
}
}
} catch ( Exception e ) {
throw new RuntimeException( e );
}
// We've read all document rows, let's update the final count.
numRows = currentRow;
// And, as this was an invalid row to ask for, throw the proper exception!
throw new ArrayIndexOutOfBoundsException( rownr );
}
private KCell[] parseRow() throws XMLStreamException {
List<StaxPoiCell> cells;
if ( isMaxColsNumberDefined() ) {
cells = new ArrayList<>( numCols );
} else {
cells = new ArrayList<>();
}
int undefinedColIndex = 0;View on GitHub (pinned to f3058517a1)