pentaho/pentaho-kettle · error · IllegalArgumentException

Clone not supported for

Error message

Clone not supported for 

What it means

BaseFileField.clone() calls super.clone() (Object.clone), which throws CloneNotSupportedException unless the runtime class implements Cloneable. If a subclass of BaseFileField is not Cloneable, the catch block rethrows it as an IllegalArgumentException naming the class. This is an internal defensive wrapper that should never fire for correctly declared classes.

Solutions

  1. Make the concrete field class implement java.lang.Cloneable (it is a marker interface, no methods needed).
  2. Verify which class name appears in the message and check its 'implements' list.
  3. As a workaround, construct a new instance and copy fields manually instead of relying on clone().

Example fix

// before
public class MyField extends BaseFileField { }
// after
public class MyField extends BaseFileField implements Cloneable { }
Defensive patterns

Strategy: try-catch

Validate before calling

if (!BaseFileField.class.isAssignableFrom(field.getClass()) || !Cloneable.class.isAssignableFrom(field.getClass())) {
  throw new IllegalStateException(field.getClass().getName() + " must implement Cloneable");
}

Type guard

boolean isCloneable(Object o) { return o instanceof Cloneable; }

Try / catch

try {
  Object copy = field.clone();
} catch (IllegalArgumentException e) {
  // fall back to manual copy
  throw new IllegalStateException("Class must implement Cloneable: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Calling clone() on a BaseFileField instance whose concrete class does not implement the Cloneable marker interface.

Common situations: Someone added a new field-meta subclass extending BaseFileField but forgot to declare 'implements Cloneable'; refactoring removed the interface; reflection/serialization frameworks cloning step metadata at transformation copy time.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/file/BaseFileField.java:142

  }

  @Override
  public int compareTo( TextFileInputFieldInterface field ) {
    return position - field.getPosition();
  }

  public boolean equal( Object obj ) {
    BaseFileField field = (BaseFileField) obj;

    return ( position == field.getPosition() );
  }

  @Override
  public Object clone() {
    try {
      return super.clone();
    } catch ( CloneNotSupportedException ex ) {
      throw new IllegalArgumentException( "Clone not supported for " + this.getClass().getName() );
    }
  }

  @Override
  public int getPosition() {
    return position;
  }

  public void setPosition( int position ) {
    this.position = position;
  }

  @Override
  public int getLength() {
    return length;
  }

  @Override

View on GitHub (pinned to f3058517a1)