{"record":{"id":"bf3c83113185e665","repo":"pentaho/pentaho-kettle","slug":"concatfields-error-targetfieldnotfoundoutputstream","errorCode":null,"errorMessage":"ConcatFields.Error.TargetFieldNotFoundOutputStream","messagePattern":"ConcatFields\\.Error\\.TargetFieldNotFoundOutputStream","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/concatfields/ConcatFields.java","lineNumber":79,"sourceCode":"\n    if ( r != null && first ) {\n      first = false;\n\n      data.inputRowMeta = getInputRowMeta();\n      data.outputRowMeta = data.inputRowMeta.clone();\n      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n        metaStore );\n\n      // the field precisions and lengths are altered! see TextFileOutputMeta.getFields().\n      // otherwise trim(), padding etc. will not work\n      data.inputRowMetaModified = getInputRowMeta().clone();\n      meta\n        .getFieldsModifyInput( getTransMeta().getBowl(), data.inputRowMetaModified, getStepname(), null, null,\n           this, repository, metaStore );\n\n      data.posTargetField = data.outputRowMeta.indexOfValue( meta.getTargetFieldName() );\n      if ( data.posTargetField < 0 ) {\n        throw new KettleStepException( BaseMessages.getString(\n          PKG, \"ConcatFields.Error.TargetFieldNotFoundOutputStream\", \"\" + meta.getTargetFieldName() ) );\n      }\n\n      data.fieldnrs = new int[ meta.getOutputFields().length ];\n      for ( int i = 0; i < meta.getOutputFields().length; i++ ) {\n        data.fieldnrs[ i ] = data.inputRowMetaModified.indexOfValue( meta.getOutputFields()[ i ].getName() );\n        if ( data.fieldnrs[ i ] < 0 ) {\n          throw new KettleStepException( BaseMessages.getString(\n            PKG, \"ConcatFields.Error.FieldNotFoundInputStream\", \"\" + meta.getOutputFields()[ i ].getName() ) );\n        }\n      }\n\n      meta.calcMetaWithFieldOptions( data );\n\n      // prepare for fast data dump (StringBuilder size)\n      data.targetFieldLengthFastDataDump = meta.getTargetFieldLength();\n      if ( data.targetFieldLengthFastDataDump <= 0 ) { // try it as a guess: 50 * size\n        if ( meta.getOutputFields().length == 0 ) {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/concatfields/ConcatFields.java#L61-L97","documentation":"ConcatFields concatenates several input fields into one target field. During processRow, after building the output row metadata, the step looks up the configured target field name in the output row metadata. If indexOfValue returns -1 (the target field is not present), it throws this KettleStepException.","triggerScenarios":"meta.getTargetFieldName() is not found in data.outputRowMeta after getFieldsModifyInput ran — typically because the target field name is misspelled, empty, or getFields() was never applied to add the target field.","commonSituations":"Users rename or delete the target field in the step dialog but stale transformations reference it; programmatic metadata construction (as in the unit tests) forgets to set targetFieldName before calling processRow.","solutions":["Set a valid, non-empty Target field name in the Concat Fields step settings.","Verify the target field name exactly matches (case-sensitive) what getFieldsModifyInput produces in the output stream.","Re-open and re-save the transformation so the step metadata is refreshed.","In test/code-driven usage, call meta.getFields(...) to inject the target field into outputRowMeta before processRow."],"exampleFix":"// before\nmeta.setTargetFieldName( null );\n// after\nmeta.setTargetFieldName( \"concatenated\" );","handlingStrategy":"validation","validationCode":"if ( meta.getTargetFieldName() == null || outputRowMeta.indexOfValue( meta.getTargetFieldName() ) < 0 ) {\n  throw new IllegalArgumentException( \"Target field not in output stream: \" + meta.getTargetFieldName() );\n}","typeGuard":null,"tryCatchPattern":"try {\n  step.processRow();\n} catch ( KettleStepException e ) {\n  if ( e.getMessage().contains( \"TargetFieldNotFoundOutputStream\" ) ) {\n    logError( \"Check the Concat Fields target field name: \" + e.getMessage() );\n  }\n}","preventionTips":["Always set a target field name in the step dialog.","Run transformation validation before execution.","Re-save transformations after upstream field renames."],"tags":["kettle","pdi","step-configuration","field-lookup"],"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"}