{"record":{"id":"e75e0568761c2a3d","repo":"pentaho/pentaho-kettle","slug":"clonerow-error-clonenumfieldmissing","errorCode":null,"errorMessage":"CloneRow.Error.CloneNumFieldMissing","messagePattern":"CloneRow\\.Error\\.CloneNumFieldMissing","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRow.java","lineNumber":78,"sourceCode":"      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 ) {\n          data.indexOfNrCloneField = getInputRowMeta().indexOfValue( cloneinfieldname );\n          if ( data.indexOfNrCloneField < 0 ) {\n            // The field is unreachable !\n            logError( BaseMessages.getString( PKG, \"CloneRow.Log.ErrorFindingField\" )\n              + \"[\" + cloneinfieldname + \"]\" );\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"CloneRow.Exception.CouldnotFindField\", cloneinfieldname ) );","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRow.java#L60-L96","documentation":"CloneRow step requires the 'clone number' output field name when 'add clone num' is enabled. processRow substitutes meta.getCloneNumField() and throws this KettleException (after logging) if it is empty or null.","triggerScenarios":"processRow with meta.isAddCloneNum()==true and getCloneNumField() empty after environment substitution (field name blank in dialog or resolves to empty).","commonSituations":"Checking 'Add clone num?' but leaving 'Nbr of clones fieldname' empty; a runtime variable that expands to nothing; metadata copied from an old step.","solutions":["Set a non-empty 'Nbr of clones fieldname' in the CloneRow dialog (e.g. 'CloneNum')","Disable 'Add clone num?' if the column is not needed","Make sure the variable in the field name is populated before the transformation runs","Validate step settings at design time instead of failing at runtime"],"exampleFix":"// before\ncloneRowMeta.setCloneNumField( \"${UNSET_VAR}\" );\n// after\ncloneRowMeta.setCloneNumField( \"CloneNum\" );","handlingStrategy":"validation","validationCode":"if (meta.isAddCloneNum() && Utils.isEmpty(meta.getCloneNumField())) {\n  throw new IllegalArgumentException(\"Clone num field is required when addCloneNum=true\");\n}","typeGuard":null,"tryCatchPattern":"catch (KettleException e) { if (e.getMessage().contains(\"CloneNumFieldMissing\")) { fail fast with config guidance; } }","preventionTips":["Set concrete field names instead of variables that may be empty","Test transformations with production variable values","Disable unused options rather than leaving half-configured fields"],"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"}