pentaho/pentaho-kettle · error · KettleException

CloneRow.Error.CloneFlagFieldMissing

Error message

CloneRow.Error.CloneFlagFieldMissing

What it means

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.

Solutions

  1. Open the CloneRow dialog and set a non-empty 'Flag fieldname' (e.g. 'IsClone')
  2. Uncheck 'Add clone flag?' if you do not need the flag column
  3. Ensure any variable used in the field name is defined at runtime (set in kettle.properties or via Set Variables before this step)
  4. Validate the step metadata before execution with meta.getXML()/dialog validation

Example fix

// before
cloneRowMeta.setCloneFlagField( "" );  // addCloneFlag=true
// after
cloneRowMeta.setCloneFlagField( "IsClone" );
Defensive patterns

Strategy: validation

Validate before calling

if (meta.isAddCloneFlag() && Utils.isEmpty(meta.getCloneFlagField())) {
  throw new IllegalArgumentException("Clone flag field is required when addCloneFlag=true");
}

Try / catch

catch (KettleException e) { if (e.getMessage().contains("CloneFlagFieldMissing")) { fail fast with config guidance; } }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/5295295f84a0cefe. Report an issue: GitHub.

Appendix: source

Thrown at plugins/core/impl/src/main/java/org/pentaho/di/trans/steps/clonerow/CloneRow.java:71

    // if no more input to be expected set done.
    if ( r == null ) {
      setOutputDone();
      return false;
    }

    if ( first ) {
      first = false;
      data.outputRowMeta = getInputRowMeta().clone();
      data.NrPrevFields = getInputRowMeta().size();
      meta.getFields( getTransMeta().getBowl(), data.outputRowMeta, getStepname(), null, null, this, repository,
        metaStore );
      data.addInfosToRow = ( meta.isAddCloneFlag() || meta.isAddCloneNum() );

      if ( meta.isAddCloneFlag() ) {
        String realflagfield = environmentSubstitute( meta.getCloneFlagField() );
        if ( Utils.isEmpty( realflagfield ) ) {
          logError( BaseMessages.getString( PKG, "CloneRow.Error.CloneFlagFieldMissing" ) );
          throw new KettleException( BaseMessages.getString( PKG, "CloneRow.Error.CloneFlagFieldMissing" ) );
        }
      }
      if ( meta.isAddCloneNum() ) {
        String realnumfield = environmentSubstitute( meta.getCloneNumField() );
        if ( Utils.isEmpty( realnumfield ) ) {
          logError( BaseMessages.getString( PKG, "CloneRow.Error.CloneNumFieldMissing" ) );
          throw new KettleException( BaseMessages.getString( PKG, "CloneRow.Error.CloneNumFieldMissing" ) );
        }
      }

      if ( meta.isNrCloneInField() ) {
        String cloneinfieldname = meta.getNrCloneField();
        if ( Utils.isEmpty( cloneinfieldname ) ) {
          logError( BaseMessages.getString( PKG, "CloneRow.Error.NrCloneInFieldMissing" ) );
          throw new KettleException( BaseMessages.getString( PKG, "CloneRow.Error.NrCloneInFieldMissing" ) );
        }
        // cache the position of the field
        if ( data.indexOfNrCloneField < 0 ) {

View on GitHub (pinned to f3058517a1)