pentaho/pentaho-kettle · error · KettleDatabaseException

Unable to retrieve auto-increment of combi insert key : +…

Error message

Unable to retrieve auto-increment of combi insert key :  + meta.getTechnicalKeyField() + , no fields in resultset

What it means

KettleDatabaseException thrown when getGeneratedKeys() after the combi insert returns a ResultSet whose first next() is false, i.e. the driver gave back no auto-generated key at all. The step needs the auto-increment technical key it just inserted; without it the dimension lookup cannot return the row's key.

Solutions

  1. Verify the technical key column in the dimension table is a real auto-increment/identity/serial column.
  2. Switch the step's 'Use auto increment' off and use a database sequence or table max+1 tech key creation method instead.
  3. Update the JDBC driver to a version that supports getGeneratedKeys for your database.
  4. If the DB supports it, configure the connection/driver so generated keys are returned (e.g. appropriate returnGeneratedKeys setting).

Example fix

// before: technical key relies on auto-increment on a driver that returns no keys
// after: in CombinationLookup step settings set Technical key field creation method
//        from 'auto increment' to 'use sequence' (e.g. seq_dim_customer) or 'table maximum'.
Defensive patterns

Strategy: validation

Validate before calling

// before the run, confirm the tech key column is auto-increment capable
// String ddl = db.getDDBinary(...) /* or query information_schema */;
// assert column is serial/identity/auto_increment for the configured technicalKeyField;

Try / catch

try { /* run */ } catch (KettleDatabaseException e) {
  if (e.getMessage().contains("no fields in resultset")) {
    log.error("Driver returned no generated keys; switch tech key creation method");
  }
}

Prevention

When it happens

Trigger: combiInsert executed the insert via prepStatementInsert and called getGeneratedKeys(), but keys.next() returned false — the JDBC driver returned an empty generated-keys result set for this statement/table.

Common situations: Databases or drivers that don't return generated keys for the configured auto-increment setup (e.g. certain PostgreSQL/Oracle configurations); technical key field not actually an auto-increment/identity column; using autoinc mode with a driver lacking Statement.RETURN_GENERATED_KEYS support.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/combinationlookup/CombinationLookup.java:630

        logRowlevel( "rins=" + data.insertRowMeta.getString( insertRow ) );
      }

      debug = "Set values on insert";
      // INSERT NEW VALUE!
      data.db.setValues( data.insertRowMeta, insertRow, data.prepStatementInsert );

      debug = "Insert row";
      data.db.insertRow( data.prepStatementInsert );

      debug = "Retrieve key";
      if ( isAutoIncrement() && databaseMeta.supportsAutoGeneratedKeys() ) {
        ResultSet keys = null;
        try {
          keys = data.prepStatementInsert.getGeneratedKeys(); // 1 key
          if ( keys.next() ) {
            val_key = new Long( keys.getLong( 1 ) );
          } else {
            throw new KettleDatabaseException( "Unable to retrieve auto-increment of combi insert key : "
              + meta.getTechnicalKeyField() + ", no fields in resultset" );
          }
        } catch ( SQLException ex ) {
          throw new KettleDatabaseException( "Unable to retrieve auto-increment of combi insert key : "
            + meta.getTechnicalKeyField(), ex );
        } finally {
          try {
            if ( keys != null ) {
              keys.close();
            }
          } catch ( SQLException ex ) {
            throw new KettleDatabaseException( "Unable to retrieve auto-increment of combi insert key : "
              + meta.getTechnicalKeyField(), ex );
          }
        }
      }
    } catch ( Exception e ) {
      logError( Const.getStackTracker( e ) );

View on GitHub (pinned to f3058517a1)