pentaho/pentaho-kettle · error · KettleException
Errors encountered (first 10): ...
Error message
Errors encountered (first 10): ...
What it means
When error handling is enabled and a batch insert fails, the step collects up to the first 10 individual exceptions from the KettleDatabaseBatchException and rethrows them as a single KettleException summarizing the batch failure. This is the aggregated report of which rows/statements in the batch failed.
Solutions
- Parse the listed messages to identify and fix the offending rows in the source data.
- Reduce commit size so fewer rows fail per batch and error rows are more precisely identified.
- Disable batch mode to get exact per-row error handling and use the error hop to route bad rows.
- Add data-cleansing steps (dedupe, type validation) upstream.
Example fix
// before: batch mode + error handling, 10 rows with duplicate PKs fail together // after: uncheck 'Use batch update' so failing rows go individually to the error hop
Defensive patterns
Strategy: try-catch
Validate before calling
// Validate rows before batch insert to avoid multi-row batch failures
for ( Object[] row : rows ) { validateRowAgainstSchema( row, tableSchema ); } Try / catch
try {
writeToTable( row );
} catch ( KettleException e ) {
if ( e.getMessage().startsWith( "Errors encountered (first 10)" ) ) {
for ( String line : e.getMessage().split( Const.CR ) ) logFailedRow( line );
// replay failing rows individually for precise error handling
}
} Prevention
- Combine batch mode with a configured error hop only if you accept coarse row identification
- Cleanse/deduplicate data before batch loads
- Use smaller commit sizes when per-row diagnostics matter
When it happens
Trigger: A KettleDatabaseBatchException is caught, getStepMeta().isDoingErrorHandling() is true, batchProblem is set, and the step builds a message with the first 10 exceptions from be.getExceptionsList() before rethrowing.
Common situations: Batch insert with multiple bad rows (duplicate keys, constraint violations, truncations); error handling configured but data quality issues present; commit size large so many rows fail per batch.
Related errors
- Error updating batch
- Unexpected error inserting row
- ColumnExists.Log.ErrorInStep
- dbInterface.getUnsupportedTableOutputMessage()
- Error inserting row into table [tableName] with values…
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/e9611b0bf0516238.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutput.java:346
updateCounts = be.getUpdateCounts();
exceptionsList = be.getExceptionsList();
if ( getStepMeta().isDoingErrorHandling() ) {
data.db.clearBatch( insertStatement );
data.db.commit( true );
} else {
data.db.clearBatch( insertStatement );
data.db.rollback();
StringBuilder msg = new StringBuilder( "Error batch inserting rows into table [" + tableName + "]." );
msg.append( Const.CR );
msg.append( "Errors encountered (first 10):" ).append( Const.CR );
for ( int x = 0; x < be.getExceptionsList().size() && x < 10; x++ ) {
Exception exception = be.getExceptionsList().get( x );
if ( exception.getMessage() != null ) {
msg.append( exception.getMessage() ).append( Const.CR );
}
}
throw new KettleException( msg.toString(), be );
}
} catch ( KettleDatabaseException dbe ) {
if ( getStepMeta().isDoingErrorHandling() ) {
if ( isRowLevel() ) {
logRowlevel( "Written row to error handling : " + getInputRowMeta().getString( r ) );
}
if ( data.useSafePoints ) {
data.db.rollback( data.savepoint );
if ( data.releaseSavepoint ) {
data.db.releaseSavepoint( data.savepoint );
}
// data.db.commit(true); // force a commit on the connection too.
}
sendToErrorRow = true;
errorMessage = dbe.toString();
} else {View on GitHub (pinned to f3058517a1)