{"record":{"id":"64e7cfeb0d0cf764","repo":"pentaho/pentaho-kettle","slug":"concatfieldsmeta-checkresult-targetfieldnamemissing","errorCode":"ConcatFieldsMeta.CheckResult.TargetFieldNameMissing","errorMessage":"ConcatFieldsMeta.CheckResult.TargetFieldNameMissing","messagePattern":"ConcatFieldsMeta\\.CheckResult\\.TargetFieldNameMissing","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsMeta.java","lineNumber":155,"sourceCode":"    // remove selected fields from the stream when true\n    if ( removeSelectedFields ) {\n      if ( getOutputFields().length > 0 ) {\n        for ( int i = 0; i < getOutputFields().length; i++ ) {\n          TextFileField field = getOutputFields()[ i ];\n          try {\n            row.removeValueMeta( field.getName() );\n          } catch ( KettleValueException e ) {\n            // just ignore exceptions since missing fields are handled in the ConcatFields class\n          }\n        }\n      } else { // no output fields selected, take them all, remove them all\n        row.clear();\n      }\n    }\n\n    // Check Target Field Name\n    if ( Utils.isEmpty( targetFieldName ) ) {\n      throw new KettleStepException( BaseMessages.getString(\n        PKG, \"ConcatFieldsMeta.CheckResult.TargetFieldNameMissing\" ) );\n    }\n    // add targetFieldName\n    ValueMetaInterface vValue = new ValueMetaString( targetFieldName );\n    vValue.setLength( targetFieldLength, 0 );\n    vValue.setOrigin( name );\n    if ( !Utils.isEmpty( getEncoding() ) ) {\n      vValue.setStringEncoding( getEncoding() );\n    }\n    row.addValueMeta( vValue );\n  }\n\n  @Override\n  public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException {\n    super.loadXML( stepnode, databases, metaStore );\n    targetFieldName = XMLHandler.getTagValue( stepnode, ConcatFieldsNodeNameSpace, \"targetFieldName\" );\n    targetFieldLength =\n      Const.toInt( XMLHandler.getTagValue( stepnode, ConcatFieldsNodeNameSpace, \"targetFieldLength\" ), 0 );","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/concatfields/ConcatFieldsMeta.java#L137-L173","documentation":"ConcatFieldsMeta.getFields() builds the output row layout and requires a target field name to add the concatenated ValueMetaString. If targetFieldName is empty, it throws this KettleStepException before producing fields.","triggerScenarios":"getFields is called (e.g., during transformation preview, validation, or processRow initialization) while meta.targetFieldName is null or the empty string.","commonSituations":"New Concat Fields step left unconfigured; programmatic meta construction in tests forgot setTargetFieldName; transformation XML lost the target-field attribute.","solutions":["Set the Target field name in the step dialog before running.","In code, call meta.setTargetFieldName(\"myField\") before getFields.","Validate the transformation (which runs step checks) before execution."],"exampleFix":"// before\nConcatFieldsMeta meta = new ConcatFieldsMeta(); // targetFieldName empty\n// after\nConcatFieldsMeta meta = new ConcatFieldsMeta();\nmeta.setTargetFieldName( \"concat\" );","handlingStrategy":"validation","validationCode":"if ( meta.getTargetFieldName() == null || meta.getTargetFieldName().isEmpty() ) {\n  throw new IllegalStateException( \"ConcatFieldsMeta requires a target field name\" );\n}","typeGuard":null,"tryCatchPattern":"try {\n  meta.getFields( row, name, null, null, null, null, metaStore );\n} catch ( KettleStepException e ) {\n  logError( \"Target field name missing: \" + e.getMessage() );\n}","preventionTips":["Configure the step fully before saving the transformation.","Run the step's check() validation in CI pipelines.","When building meta programmatically, always call setTargetFieldName."],"tags":["kettle","pdi","missing-field","step-metadata"],"backgroundTag":"empty-required-field","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"}