pentaho/pentaho-kettle · error · RuntimeException
Unable to clone import rule
Error message
Unable to clone import rule
What it means
BaseImportRule.clone() overrides Object.clone() to copy import rules; since CloneNotSupportedException is checked and the interface contract expects clonability, it rethrows it as a RuntimeException "Unable to clone import rule" with the cause attached. Reaching it means a rule subclass somehow inherited clone support incorrectly (effectively an internal invariant violation).
Solutions
- Ensure your rule class (and BaseImportRule hierarchy) implements java.lang.Cloneable.
- Inspect getCause() (CloneNotSupportedException) to identify which class in the hierarchy is not cloneable.
- In a custom rule, override clone() to use super.clone() and implement Cloneable rather than replacing the mechanism.
- As a workaround, perform a deep copy by re-creating the rule and copying its fields instead of relying on clone().
Example fix
// before
public class MyRule extends BaseImportRule { // no Cloneable handling
public MyRule copy() { return (MyRule) clone(); }
}
// after
public class MyRule extends BaseImportRule implements Cloneable {
public MyRule copy() { return (MyRule) super.clone(); }
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!(rule instanceof Cloneable)) {
throw new IllegalStateException("Rule must implement Cloneable to be copied");
} Try / catch
try {
ImportRuleInterface copy = rule.clone();
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().contains("Unable to clone")) {
log.error("Rule class does not support cloning: " + rule.getClass().getName(), e.getCause());
} else {
throw e;
}
} Prevention
- Always implement Cloneable in custom rule subclasses
- Keep super.clone() as the copy mechanism in overrides
- Inspect getCause() when clone fails to find the offending class
When it happens
Trigger: Calling clone() (directly or via ImportRules copy/duplicate operations) on a rule whose class hierarchy does not properly support cloning — e.g. a subclass not implementing Clonenable transitively or super.clone() failing in a custom rule implementation.
Common situations: Custom import rule plugins that override clone or reshape the hierarchy without honoring the Cloneable contract; classloader/version mixing where the rule class was loaded in a way that broke the standard clone path.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Clone not supported for
- Clone not supported for
- Clone not supported for
- Clone not supported for
- KettleValueException wrapping KettlePluginException from…
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/03e3b8c746dffbfe.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/imp/rules/BaseImportRule.java:45
import org.w3c.dom.Node;
public abstract class BaseImportRule implements ImportRuleInterface {
public static String XML_TAG = "rule";
private String id;
private boolean enabled;
public BaseImportRule() {
this.enabled = false;
}
@Override
public ImportRuleInterface clone() {
try {
return (ImportRuleInterface) super.clone();
} catch ( CloneNotSupportedException e ) {
throw new RuntimeException( "Unable to clone import rule", e );
}
}
@Override
public boolean isUnique() {
return true;
}
@Override
public abstract List<ImportValidationFeedback> verifyRule( Object subject );
@Override
public String getXML() {
StringBuilder xml = new StringBuilder();
xml.append( XMLHandler.addTagValue( "id", id ) );
xml.append( XMLHandler.addTagValue( "enabled", enabled ) );
View on GitHub (pinned to f3058517a1)