{"record":{"id":"5295295f84a0cefe","repo":"pentaho/pentaho-kettle","slug":"clonerow-error-cloneflagfieldmissing","errorCode":null,"errorMessage":"CloneRow.Error.CloneFlagFieldMissing","messagePattern":"CloneRow\\.Error\\.CloneFlagFieldMissing","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRow.java","lineNumber":71,"sourceCode":"    // if no more input to be expected set done.\n    if ( r == null ) {\n      setOutputDone();\n      return false;\n    }\n\n    if ( first ) {\n      first = false;\n      data.outputRowMeta = getInputRowMeta().clone();\n      data.NrPrevFields = getInputRowMeta().size();\n      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,\n        metaStore );\n      data.addInfosToRow = ( meta.isAddCloneFlag() || meta.isAddCloneNum() );\n\n      if ( meta.isAddCloneFlag() ) {\n        String realflagfield = environmentSubstitute( meta.getCloneFlagField() );\n        if ( Utils.isEmpty( realflagfield ) ) {\n          logError( BaseMessages.getString( PKG, \"CloneRow.Error.CloneFlagFieldMissing\" ) );\n          throw new KettleException( BaseMessages.getString( PKG, \"CloneRow.Error.CloneFlagFieldMissing\" ) );\n        }\n      }\n      if ( meta.isAddCloneNum() ) {\n        String realnumfield = environmentSubstitute( meta.getCloneNumField() );\n        if ( Utils.isEmpty( realnumfield ) ) {\n          logError( BaseMessages.getString( PKG, \"CloneRow.Error.CloneNumFieldMissing\" ) );\n          throw new KettleException( BaseMessages.getString( PKG, \"CloneRow.Error.CloneNumFieldMissing\" ) );\n        }\n      }\n\n      if ( meta.isNrCloneInField() ) {\n        String cloneinfieldname = meta.getNrCloneField();\n        if ( Utils.isEmpty( cloneinfieldname ) ) {\n          logError( BaseMessages.getString( PKG, \"CloneRow.Error.NrCloneInFieldMissing\" ) );\n          throw new KettleException( BaseMessages.getString( PKG, \"CloneRow.Error.NrCloneInFieldMissing\" ) );\n        }\n        // cache the position of the field\n        if ( data.indexOfNrCloneField < 0 ) {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRow.java#L53-L89","documentation":"CloneRow step requires the 'clone flag' output field name when 'add clone flag' is enabled. processRow environment-substitutes meta.getCloneFlagField() and, if empty/null, logs and throws this KettleException before processing any rows.","triggerScenarios":"processRow with meta.isAddCloneFlag()==true and getCloneFlagField() empty after variable substitution (field never set in the dialog, or set to a variable that resolves to empty).","commonSituations":"Enabling 'Add clone flag?' but leaving 'Flag fieldname' blank; using ${VAR} whose value is unset/empty at runtime; copying step config from another transformation without the field name.","solutions":["Open the CloneRow dialog and set a non-empty 'Flag fieldname' (e.g. 'IsClone')","Uncheck 'Add clone flag?' if you do not need the flag column","Ensure any variable used in the field name is defined at runtime (set in kettle.properties or via Set Variables before this step)","Validate the step metadata before execution with meta.getXML()/dialog validation"],"exampleFix":"// before\ncloneRowMeta.setCloneFlagField( \"\" );  // addCloneFlag=true\n// after\ncloneRowMeta.setCloneFlagField( \"IsClone\" );","handlingStrategy":"validation","validationCode":"if (meta.isAddCloneFlag() && Utils.isEmpty(meta.getCloneFlagField())) {\n  throw new IllegalArgumentException(\"Clone flag field is required when addCloneFlag=true\");\n}","typeGuard":null,"tryCatchPattern":"catch (KettleException e) { if (e.getMessage().contains(\"CloneFlagFieldMissing\")) { fail fast with config guidance; } }","preventionTips":["Never leave the flag field blank when the option is enabled","Avoid empty-resolving variables in field-name settings","Validate step dialogs before saving transformations"],"tags":["kettle","clone-row","configuration"],"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"}