{"record":{"id":"ec54a01f256a8fb3","repo":"pentaho/pentaho-kettle","slug":"mappinginputmeta-exception-unknownfield","errorCode":"MappingInputMeta.Exception.UnknownField","errorMessage":"Unable to find field '{0}' in the input rows metadata.","messagePattern":"Unable to find field '(.+?)' in the input rows metadata\\.","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta.java","lineNumber":268,"sourceCode":"              throw new KettleStepException( BaseMessages.getString(\n                PKG, \"MappingInput.Exception.UnableToFindMappedValue\", valueRename.getSourceValueName() ) );\n            }\n          } else {\n            valueMeta.setName( valueRename.getTargetValueName() );\n          }\n        }\n      }\n\n      if ( selectingAndSortingUnspecifiedFields ) {\n        // Select the specified fields from the input, re-order everything and put the other fields at the back,\n        // sorted...\n        //\n        RowMetaInterface newRow = new RowMeta();\n\n        for ( int i = 0; i < fieldName.length; i++ ) {\n          int index = inputRowMeta.indexOfValue( fieldName[ i ] );\n          if ( index < 0 ) {\n            throw new KettleStepException( BaseMessages.getString(\n              PKG, \"MappingInputMeta.Exception.UnknownField\", fieldName[ i ] ) );\n          }\n\n          newRow.addValueMeta( inputRowMeta.getValueMeta( index ) );\n        }\n\n        // Now get the unspecified fields.\n        // Sort the fields\n        // Add them after the specified fields...\n        //\n        List<String> extra = new ArrayList<String>();\n        for ( int i = 0; i < inputRowMeta.size(); i++ ) {\n          String fieldName = inputRowMeta.getValueMeta( i ).getName();\n          if ( newRow.indexOfValue( fieldName ) < 0 ) {\n            extra.add( fieldName );\n          }\n        }\n        Collections.sort( extra );","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/mappinginput/MappingInputMeta.java#L250-L286","documentation":"When the Mapping Input step is configured to select and sort specified fields only, getFields() rebuilds the output row from the fields listed in fieldName[]. If any listed field is not present in the input row metadata (indexOfValue returns -1), this KettleStepException is thrown naming the missing field. It means the step's selected-field list is out of sync with the actual incoming fields.","triggerScenarios":"getFields() with isSelectingAndSortingUnspecifiedFields=true: inputRowMeta.indexOfValue(fieldName[i]) < 0 for an entry of the configured field list.","commonSituations":"Selecting specific fields in the Mapping Input dialog that the parent doesn't send; upstream schema change removing a selected field; typo'd field name in the step configuration; loading a mapping designed against a different parent transformation.","solutions":["Open the Mapping Input step and remove/correct the field listed in the error message.","Preview the parent hop output and re-select fields from the actual layout.","Enable 'selecting and sorting unspecified fields' appropriately, or clear the explicit field list.","Re-save the sub-transformation after upstream schema changes to refresh metadata."],"exampleFix":"// before: selected field missing upstream\nfieldName = new String[] { \"id\", \"legacy_col\" };\n// after\nfieldName = new String[] { \"id\", \"renamed_col\" }; // matches upstream","handlingStrategy":"validation","validationCode":"if (mappingInputMeta.isSelectingAndSortingUnspecifiedFields()) {\n  for (String f : mappingInputMeta.getFieldName()) {\n    if (inputRowMeta.indexOfValue(f) < 0) {\n      throw new IllegalStateException(\"Selected field missing upstream: \" + f);\n    }\n  }\n}","typeGuard":"boolean allFieldsPresent(RowMetaInterface meta, String[] fields) {\n  return Arrays.stream(fields).allMatch(f -> meta.indexOfValue(f) >= 0);\n}","tryCatchPattern":"try {\n  trans.waitUntilFinished();\n} catch (KettleStepException e) {\n  if (e.getMessage().contains(\"Unable to find field\")) {\n    // remove or rename the field listed in the message in the Mapping Input dialog\n  }\n  throw e;\n}","preventionTips":["Keep the selected-field list synced with the parent transformation's output.","Preview upstream rows whenever upstream steps change.","Remove unused fields from the selection when refactoring upstream steps.","Re-save the sub-transformation after schema migrations."],"tags":["kettle","pdi","field-selection","row-metadata","schema-drift"],"backgroundTag":"resource-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"}