{"record":{"id":"2771dd9b837b778c","repo":"pentaho/pentaho-kettle","slug":"unable-to-find-field-fieldstream-i-in-the-input-rows","errorCode":null,"errorMessage":"Unable to find field [\" + fieldStream[i] + \"] in the input rows","messagePattern":"Unable to find field \\[\" \\+ fieldStream\\[i\\] \\+ \"\\] in the input rows","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoaderMeta.java","lineNumber":577,"sourceCode":"  @Override\n  public SQLStatement getSQLStatements( TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev,\n    Repository repository, IMetaStore metaStore ) throws KettleStepException {\n    SQLStatement retval = new SQLStatement( stepMeta.getName(), databaseMeta, null ); // default: nothing to do!\n\n    if ( databaseMeta != null ) {\n      if ( prev != null && prev.size() > 0 ) {\n        // Copy the row\n        RowMetaInterface tableFields = new RowMeta();\n\n        // Now change the field names\n        for ( int i = 0; i < fieldTable.length; i++ ) {\n          ValueMetaInterface v = prev.searchValueMeta( fieldStream[i] );\n          if ( v != null ) {\n            ValueMetaInterface tableField = v.clone();\n            tableField.setName( fieldTable[i] );\n            tableFields.addValueMeta( tableField );\n          } else {\n            throw new KettleStepException( \"Unable to find field [\" + fieldStream[i] + \"] in the input rows\" );\n          }\n        }\n\n        if ( !Utils.isEmpty( tableName ) ) {\n          Database db = new Database( loggingObject, databaseMeta );\n          db.shareVariablesWith( transMeta );\n          try {\n            db.connect();\n\n            String schemaTable =\n              databaseMeta.getQuotedSchemaTableCombination(\n                transMeta.environmentSubstitute( schemaName ), transMeta.environmentSubstitute( tableName ) );\n            String sql = db.getDDL( schemaTable, tableFields, null, false, null, true );\n\n            if ( sql.length() == 0 ) {\n              retval.setSQL( null );\n            } else {\n              retval.setSQL( sql );","sourceCodeStart":559,"sourceCodeEnd":595,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/gp-bulk-loader/core/src/main/java/org/pentaho/di/trans/steps/gpbulkloader/GPBulkLoaderMeta.java#L559-L595","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the GP Bulk Loader step and refresh the field mapping from the input fields (Get Fields)","Fix or remove the mapping entry referencing the missing stream field","Re-run the upstream step preview to confirm the current field names, then re-map","Check for case differences between the configured name and the row metadata"],"exampleFix":"// before\n// mapping references \"customer_id\" but upstream renamed it\nthrow new KettleStepException( \"Unable to find field [\" + fieldStream[i] + \"] in the input rows\" );\n// after: fix in the dialog — remap stream field\n// fieldStream[i] = \"customer_id\" -> fieldStream[i] = \"cust_id\" (match upstream output)","handlingStrategy":"validation","validationCode":"// validate mappings before generating SQL\nfor ( RowMetaAndData prev : prevFields ) {\n  for ( String streamField : fieldStream ) {\n    if ( prev.getRowMeta().searchValueMeta( streamField ) == null ) {\n      throw new IllegalStateException( \"Field not in input: \" + streamField );\n    }\n  }\n}","typeGuard":"boolean fieldExists = rowMeta.searchValueMeta( streamField ) != null;","tryCatchPattern":"try { sql = meta.getSQLStatements( transMeta, stepMeta, prev, metadataProvider ); } catch ( KettleStepException e ) { /* remap fields, refresh input */ }","preventionTips":["Use the step dialog's 'Get Fields' instead of typing field names manually","Refresh mappings after renaming upstream fields","Preview upstream output to confirm field names before configuring the loader","Watch for case-sensitivity mismatches in field names"],"tags":["kettle","field-mapping","validation","sql-generation"],"backgroundTag":"record-not-found","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}