pentaho/pentaho-kettle · error · KettleStepException

Unable to find field [" + fieldStream[i] + "] in the input…

Error message

Unable to find field [" + fieldStream[i] + "] in the input rows

What it means

GPLoadMeta.getSQLStatements() iterates the configured stream-to-table field mapping. For each entry it looks up the stream field name in the previous step's row layout via prev.searchValueMeta(fieldStream[i]); if the name is absent the mapping is broken and a KettleStepException is thrown. This is a fail-fast check so invalid mappings never reach generated SQL or the GPLoad load.

Solutions

  1. Open the GPLoad step dialog and re-map the Fields tab to field names that exist in the input rows
  2. Run a Get Fields in the dialog to refresh the mapping from the actual upstream row layout
  3. Check the upstream step for renamed/deleted fields and restore the original field name
  4. Verify the field stream/table arrays have equal length and no stale entries in the step metadata (ktr XML)

Example fix

// before (stale mapping after upstream rename)
fieldStream = new String[] { "cust_name_old" };
// after
fieldStream = new String[] { "customer_name" }; // matches prev.searchValueMeta()
Defensive patterns

Strategy: validation

Validate before calling

// Java, before building/saving the step
RowMetaInterface prev = transMeta.getPrevStepFields(stepMeta);
for (String streamField : fieldStream) {
  if (prev.searchValueMeta(streamField) == null) {
    throw new IllegalStateException("Field not in input rows: " + streamField);
  }
}

Try / catch

try { meta.getSQLStatements(...) } catch (KettleStepException e) { log.error("Broken GPLoad field mapping: " + e.getMessage()); }

Prevention

When it happens

Trigger: Calling getSQLStatements()/sql() when fieldStream[i] does not exist in the row fields coming from the previous step — e.g. the upstream step was changed/renamed after the GPLoad mapping was configured, or the mapping references a deleted field.

Common situations: Renaming an upstream field without re-editing the GPLoad step; deleting a field in a Select Values/Filter step feeding GPLoad; loading a transformation whose upstream hop changed; copy-pasting steps between transformations with different row layouts.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at plugins/gpload/core/src/main/java/org/pentaho/di/trans/steps/gpload/GPLoadMeta.java:696

  public SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev,
      Repository repository, IMetaStore metaStore ) throws KettleStepException {
    SQLStatement retval = new SQLStatement( stepMeta.getName(), databaseMeta, null ); // default: nothing to do!

    if ( databaseMeta != null ) {
      if ( prev != null && prev.size() > 0 ) {
        // Copy the row
        RowMetaInterface tableFields = new RowMeta();

        // Now change the field names
        for ( int i = 0; i < fieldTable.length; i++ ) {
          ValueMetaInterface v = prev.searchValueMeta( fieldStream[i] );
          if ( v != null ) {
            ValueMetaInterface tableField = v.clone();
            tableField.setName( fieldTable[i] );
            tableFields.addValueMeta( tableField );
          } else {
            throw new KettleStepException( "Unable to find field [" + fieldStream[i] + "] in the input rows" );
          }
        }

        if ( !Utils.isEmpty( tableName ) ) {
          Database db = new Database( loggingObject, databaseMeta );
          db.shareVariablesWith( transMeta );
          try {
            db.connect();

            String schemaTable =
                databaseMeta.getQuotedSchemaTableCombination( transMeta.environmentSubstitute( schemaName ), transMeta
                    .environmentSubstitute( tableName ) );
            String sql = db.getDDL( schemaTable, tableFields, null, false, null, true );

            if ( sql.length() == 0 ) {
              retval.setSQL( null );
            } else {
              retval.setSQL( sql );

View on GitHub (pinned to f3058517a1)