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

Raised by GPBulkLoaderMeta.getSQLStatements when a field name configured in the step's field mapping (fieldStream[i]) cannot be found in the incoming row layout (prev). The step validates each mapped stream field against the previous step's fields before generating SQL for table creation. This indicates the mapping references a field the upstream step no longer produces.

Solutions

  1. Open the GP Bulk Loader step and refresh the field mapping from the input fields (Get Fields)
  2. Fix or remove the mapping entry referencing the missing stream field
  3. Re-run the upstream step preview to confirm the current field names, then re-map
  4. Check for case differences between the configured name and the row metadata

Example fix

// before
// mapping references "customer_id" but upstream renamed it
throw new KettleStepException( "Unable to find field [" + fieldStream[i] + "] in the input rows" );
// after: fix in the dialog — remap stream field
// fieldStream[i] = "customer_id" -> fieldStream[i] = "cust_id" (match upstream output)
Defensive patterns

Strategy: validation

Validate before calling

// validate mappings before generating SQL
for ( RowMetaAndData prev : prevFields ) {
  for ( String streamField : fieldStream ) {
    if ( prev.getRowMeta().searchValueMeta( streamField ) == null ) {
      throw new IllegalStateException( "Field not in input: " + streamField );
    }
  }
}

Type guard

boolean fieldExists = rowMeta.searchValueMeta( streamField ) != null;

Try / catch

try { sql = meta.getSQLStatements( transMeta, stepMeta, prev, metadataProvider ); } catch ( KettleStepException e ) { /* remap fields, refresh input */ }

Prevention

When it happens

Trigger: Calling getSQLStatements (via the sql/GetSQL action) after the previous step's output fields were renamed, removed, or reordered while the GP Bulk Loader mapping still references the old stream field name.

Common situations: Upstream step was edited and a field renamed; transformation loaded from repository has stale field mappings; case mismatch between the mapping and the actual row field name.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoaderMeta.java:577

  @Override
  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)