pentaho/pentaho-kettle · error · KettleException

Error inserting row into table [tableName] with values…

Error message

Error inserting row into table [tableName] with values: rowValues

What it means

A non-batch single-row insert failed with a KettleDatabaseException; when error handling is not configured for the step, the transaction is rolled back (data.db.rollback()) and a KettleException naming the target table and the offending row values is thrown. It is the per-row insert failure report for table output.

Solutions

  1. Read the row values in the message to find the offending field, then fix the data upstream.
  2. Compare the input row schema against the target table schema (types, lengths, nullability).
  3. Enable error handling on the step and connect the error hop to route bad rows instead of failing the transformation.
  4. Verify the table definition is current (someone may have altered constraints).

Example fix

// before: inserting 200-char string into VARCHAR(100)
// after: add a truncate/mapping step upstream or ALTER TABLE target MODIFY col VARCHAR(255)
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate a row against the table schema before insert
for ( int i = 0; i < rowMeta.size(); i++ ) {
  ValueMetaInterface vm = rowMeta.getValueMeta( i );
  if ( r[i] == null && !isNullable( tableSchema, vm.getName() ) ) {
    throw new IllegalArgumentException( "NOT NULL violation on " + vm.getName() );
  }
}

Try / catch

try {
  writeToTable( row );
} catch ( KettleException e ) {
  if ( e.getMessage().startsWith( "Error inserting row into table" ) ) {
    log.error( e.getMessage() ); // includes table name + offending row values
    // route row to error handling or fix data
  }
}

Prevention

When it happens

Trigger: data.db.insertRow (or equivalent) throws KettleDatabaseException, the step warns-count is not exceeded, getStepMeta().isDoingErrorHandling() is false, so rollback() runs and the KettleException with tableName + rowValues is thrown from writeToTable.

Common situations: Constraint violations on individual rows; value too long for column; wrong data types vs table schema; NULL in NOT NULL column; table schema changed since transformation was designed.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/58e6f588dd712ca5. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/tableoutput/TableOutput.java:381

        errorMessage = dbe.toString();
      } else {
        if ( meta.ignoreErrors() ) {
          if ( data.warnings < 20 ) {
            if ( log.isBasic() ) {
              logBasic( "WARNING: Couldn't insert row into table: "
                + rowMeta.getString( r ) + Const.CR + dbe.getMessage() );
            }
          } else if ( data.warnings == 20 ) {
            if ( log.isBasic() ) {
              logBasic( "FINAL WARNING (no more then 20 displayed): Couldn't insert row into table: "
                + rowMeta.getString( r ) + Const.CR + dbe.getMessage() );
            }
          }
          data.warnings++;
        } else {
          setErrors( getErrors() + 1 );
          data.db.rollback();
          throw new KettleException( "Error inserting row into table ["
            + tableName + "] with values: " + rowMeta.getString( r ), dbe );
        }
      }
    }

    // We need to add a key
    if ( generatedKey != null ) {
      outputRowData = RowDataUtil.addValueData( outputRowData, rowMeta.size(), generatedKey );
    }

    if ( data.batchMode ) {
      if ( sendToErrorRow ) {
        if ( batchProblem ) {
          data.batchBuffer.add( outputRowData );
          outputRowData = null;

          processBatchException( errorMessage, updateCounts, exceptionsList );
        } else {

View on GitHub (pinned to f3058517a1)