{"record":{"id":"80cfb6fb6d346f8f","repo":"apache/pulsar","slug":"failed-to-clone-producerconfigurationdata","errorCode":null,"errorMessage":"Failed to clone ProducerConfigurationData","messagePattern":"Failed to clone ProducerConfigurationData","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"pulsar-client/src/main/java/org/apache/pulsar/client/impl/conf/ProducerConfigurationData.java","lineNumber":265,"sourceCode":"\n    /**\n     *\n     * Returns true if encryption keys are added.\n     *\n     */\n    @JsonIgnore\n    public boolean isEncryptionEnabled() {\n        return (this.encryptionKeys != null) && !this.encryptionKeys.isEmpty() && (this.cryptoKeyReader != null);\n    }\n\n    public ProducerConfigurationData clone() {\n        try {\n            ProducerConfigurationData c = (ProducerConfigurationData) super.clone();\n            c.encryptionKeys = Sets.newTreeSet(this.encryptionKeys);\n            c.properties = new TreeMap<>(this.properties);\n            return c;\n        } catch (CloneNotSupportedException e) {\n            throw new RuntimeException(\"Failed to clone ProducerConfigurationData\", e);\n        }\n    }\n\n    public void setProducerName(String producerName) {\n        checkArgument(StringUtils.isNotBlank(producerName), \"producerName cannot be blank\");\n        this.producerName = producerName;\n    }\n\n    public void setMaxPendingMessages(int maxPendingMessages) {\n        checkArgument(maxPendingMessages >= 0, \"maxPendingMessages needs to be >= 0\");\n        this.maxPendingMessages = maxPendingMessages;\n        this.maxPendingMessagesConfigured = true;\n    }\n\n    /**\n     * The across-partitions budget used to be rejected when it was below {@link #maxPendingMessages},\n     * which made the two setters order-dependent: it depended on which of them had been called first,\n     * and it made {@code loadConf} fail outright for any positive {@code maxPendingMessages}, since","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client/src/main/java/org/apache/pulsar/client/impl/conf/ProducerConfigurationData.java#L247-L283","documentation":"ProducerConfigurationData.clone() performs a deep copy of encryptionKeys and properties and wraps the theoretically-impossible CloneNotSupportedException in this RuntimeException. Like the consumer variant, it is a defensive guard that should not fire for correctly built jars.","triggerScenarios":"Triggered by resolved() when ProducerImpl/PulsarClient prepares the final producer configuration and needs a defensive copy of ProducerConfigurationData.","commonSituations":"Only realistically hit under classpath corruption, shading issues, or bytecode agents altering the class hierarchy.","solutions":["Verify no mixed versions of pulsar-client jars on the classpath.","Disable bytecode instrumentation/shading plugins that could modify pulsar-client classes and retry.","If reproducible on a clean classpath, file a bug with the Pulsar project."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { ProducerConfigurationData copy = conf.clone(); } catch (RuntimeException e) { /* rebuild conf via copy constructor semantics */ }","preventionTips":["Avoid mixed pulsar-client jar versions in fat jars.","Disable instrumentation that alters Cloneable semantics on library classes.","If seen reproducibly, report upstream."],"tags":["clone","internal","producer","configuration"],"backgroundTag":"clone-not-supported","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}