apache/pulsar · error · RuntimeException

Failed to clone ReaderConfigurationData

Error message

Failed to clone ReaderConfigurationData

What it means

ReaderConfigurationData.clone() deep-copies the topicNames set to avoid shared mutable state and wraps CloneNotSupportedException in this RuntimeException. As with the other configuration clones, the exception is defensive and unreachable for correctly built classes since the class implements Cloneable.

Source

Thrown at pulsar-client/src/main/java/org/apache/pulsar/client/impl/conf/ReaderConfigurationData.java:199

        }
        return topicNames.iterator().next();
    }

    @JsonIgnore
    public void setTopicName(String topicNames) {
        //Compatible with a single topic
        this.topicNames.clear();
        this.topicNames.add(topicNames);
    }

    @SuppressWarnings("unchecked")
    public ReaderConfigurationData<T> clone() {
        try {
            ReaderConfigurationData<T> clone = (ReaderConfigurationData<T>) super.clone();
            clone.setTopicNames(new HashSet<>(clone.getTopicNames()));
            return clone;
        } catch (CloneNotSupportedException e) {
            throw new RuntimeException("Failed to clone ReaderConfigurationData");
        }
    }

    @SuppressFBWarnings({"EI_EXPOSE_REP"})
    public MessageCrypto<?, ?> getMessageCrypto() {
        return messageCrypto;
    }

    @SuppressFBWarnings({"EI_EXPOSE_REP2"})
    public void setMessageCrypto(MessageCrypto<?, ?> messageCrypto) {
        this.messageCrypto = messageCrypto;
    }
}

View on GitHub (pinned to 820761864e)

Solutions

  1. Check for bytecode agents or shading that could affect Cloneable on pulsar-client classes.
  2. Use a single consistent version of pulsar-client dependencies.
  3. If reproducible on a clean classpath, report a bug to the Pulsar project.
Defensive patterns

Strategy: try-catch

Try / catch

try { ReaderConfigurationData<T> copy = conf.clone(); } catch (RuntimeException e) { /* rebuild configuration manually */ }

Prevention

When it happens

Trigger: Called whenever PulsarClientImpl.createReaderAsync makes a defensive copy of reader configuration before use.

Common situations: Only expected under classpath corruption, shading, or instrumentation agents that alter the pulsar-client classes.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/de3a71d86a8bec3c. Report an issue: GitHub.