{"record":{"id":"f8f10706ec9d3505","repo":"pentaho/pentaho-kettle","slug":"clonerow-error-nrcloneinfieldmissing","errorCode":null,"errorMessage":"CloneRow.Error.NrCloneInFieldMissing","messagePattern":"CloneRow\\.Error\\.NrCloneInFieldMissing","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRow.java","lineNumber":86,"sourceCode":"        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 ) );\n          }\n        }\n      } else {\n        String nrclonesString = environmentSubstitute( meta.getNrClones() );\n        data.nrclones = Const.toInt( nrclonesString, 0 );\n        if ( log.isDebug() ) {\n          logDebug( BaseMessages.getString( PKG, \"CloneRow.Log.NrClones\", \"\" + data.nrclones ) );\n        }","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRow.java#L68-L104","documentation":"First-row validation in CloneRow.processRow: the option to add a clone-number field is enabled, but the Clone number field name is empty (after environment substitution), so the step has nowhere to write the clone counter.","triggerScenarios":"processRow with meta.isNrCloneInField()==true and getNrCloneField() empty (field name never entered, or variable resolves to empty).","commonSituations":"Enabling 'clone count from field' and forgetting to name the field; variable-based field name not set in the environment; step copied from a template missing the value.","solutions":["Enter the input field name that contains the clone count in the CloneRow dialog","Turn off 'nr clones in field?' and instead use the fixed 'Nr of clones' value","Verify the variable used resolves to a non-empty value at runtime","Add a design-time check that the configured field exists in the incoming stream"],"exampleFix":"// before\ncloneRowMeta.setNrCloneField( null );  // nrCloneInField=true\n// after\ncloneRowMeta.setNrCloneField( \"clone_count\" );","handlingStrategy":"validation","validationCode":"if (meta.isNrCloneInField() && Utils.isEmpty(meta.getNrCloneField())) {\n  throw new IllegalArgumentException(\"NrCloneField is required when nrCloneInField=true\");\n}","typeGuard":null,"tryCatchPattern":"catch (KettleException e) { if (e.getMessage().contains(\"NrCloneInFieldMissing\")) { fail fast with config guidance; } }","preventionTips":["Choose between a fixed clone count OR a count field; do not enable the field mode without naming the field","Check dialog completeness before saving","Use design-time metadata validation"],"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"}