pentaho/pentaho-kettle · error · IllegalArgumentException

Clone not supported for

Error message

Clone not supported for 

What it means

BaseFileInputAdditionalField.clone() delegates to Object.clone(), which requires the runtime class to implement Cloneable; otherwise CloneNotSupportedException is wrapped in an IllegalArgumentException naming the class. File input step metadata is cloned when transformations are copied or executed, so subclasses must be Cloneable.

Solutions

  1. Add 'implements Cloneable' to the concrete subclass shown in the message.
  2. Re-check after Kettle version upgrades that custom metadata classes still satisfy Cloneable.
  3. Replace clone() usage with an explicit copy constructor if cloning cannot be fixed.

Example fix

// before
public class MyAdditionalFields extends BaseFileInputAdditionalField { }
// after
public class MyAdditionalFields extends BaseFileInputAdditionalField implements Cloneable { }
Defensive patterns

Strategy: try-catch

Validate before calling

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

Type guard

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

Try / catch

try {
  Object copy = additionalField.clone();
} catch (IllegalArgumentException e) {
  throw new IllegalStateException("Implement Cloneable on " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Cloning a BaseFileInputAdditionalField instance whose concrete class does not implement Cloneable, e.g. during transformation metadata duplication or step init.

Common situations: Custom extensions of BaseFileInputAdditionalField missing the Cloneable marker; plugin upgrades where the base class hierarchy changed; Kettle copying step metadata at run 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/04968498888b6c71. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/file/BaseFileInputAdditionalField.java:48

  @Injection( name = "FILE_PATH_FIELDNAME" )
  public String pathField;
  @Injection( name = "FILE_SIZE_FIELDNAME" )
  public String sizeField;
  @Injection( name = "FILE_HIDDEN_FIELDNAME" )
  public String hiddenField;
  @Injection( name = "FILE_LAST_MODIFICATION_FIELDNAME" )
  public String lastModificationField;
  @Injection( name = "FILE_URI_FIELDNAME" )
  public String uriField;
  @Injection( name = "FILE_ROOT_URI_FIELDNAME" )
  public String rootUriField;

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

  /**
   * Set null for all empty field values to be able to fast check during step processing. Need to be executed once
   * before processing.
   */
  public void normalize() {
    if ( StringUtils.isBlank( shortFilenameField ) ) {
      shortFilenameField = null;
    }
    if ( StringUtils.isBlank( extensionField ) ) {
      extensionField = null;
    }
    if ( StringUtils.isBlank( pathField ) ) {
      pathField = null;
    }
    if ( StringUtils.isBlank( sizeField ) ) {

View on GitHub (pinned to f3058517a1)