{"record":{"id":"f1bb52bae7df0397","repo":"apache/pulsar","slug":"cause-getmessage-f1bb52","errorCode":null,"errorMessage":"${cause.getMessage()}","messagePattern":"\\$\\{cause\\.getMessage\\(\\)\\}","errorType":"exception","errorClass":"org.apache.pulsar.client.impl.v5.PulsarClientException","httpStatus":null,"severity":"error","filePath":"pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/PulsarClientV5.java","lineNumber":85,"sourceCode":"    }\n\n    @Override\n    public <T> QueueConsumerBuilder<T> newQueueConsumer(Schema<T> schema) {\n        return new QueueConsumerBuilderV5<>(this, schema);\n    }\n\n    @Override\n    public <T> CheckpointConsumerBuilder<T> newCheckpointConsumer(Schema<T> schema) {\n        return new CheckpointConsumerBuilderV5<>(this, schema);\n    }\n\n    @Override\n    public Transaction newTransaction() throws PulsarClientException {\n        try {\n            return newTransactionAsync().get();\n        } catch (ExecutionException e) {\n            Throwable cause = e.getCause() != null ? e.getCause() : e;\n            throw new PulsarClientException(cause.getMessage(), cause);\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            throw new PulsarClientException(\"Interrupted while creating transaction\", e);\n        }\n    }\n\n    @Override\n    public CompletableFuture<Transaction> newTransactionAsync() {\n        var builder = v4Client.newTransaction();\n        if (transactionTimeout != null) {\n            builder.withTransactionTimeout(transactionTimeout.toMillis(), TimeUnit.MILLISECONDS);\n        }\n        return builder.build().thenApply(v4Txn -> (Transaction) new TransactionV5(v4Txn));\n    }\n\n    @Override\n    public void close() throws PulsarClientException {\n        try {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/PulsarClientV5.java#L67-L103","documentation":"The synchronous newTransaction() waits on newTransactionAsync().get(); if the async transaction-creation completes exceptionally, the ExecutionException is unwrapped and its cause is re-thrown as a PulsarClientException carrying the underlying message. The dynamic message reflects whatever actually went wrong on the broker/client during transaction creation (e.g. transaction coordinator unavailable, client closed).","triggerScenarios":"Calling PulsarClientV5.newTransaction() when the underlying v4 client's async transaction creation fails — broker has no transaction coordinator assigned, transactions are disabled in broker config, or the client was already closed.","commonSituations":"Enabling transactional producers on a broker where transactionCoordinatorEnabled=false; hitting a broker that does not support the transaction API; calling newTransaction() after close(); timeouts waiting for a coordinator.","solutions":["Read the wrapped cause's message for the real failure (coordinator unavailable, client closed, timeout)","Ensure the broker has transactions enabled (transactionCoordinatorEnabled=true) and is reachable","Verify the client is not already closed and retry transaction creation"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    Transaction tx = client.newTransaction();\n} catch (PulsarClientException e) {\n    log.error(\"Transaction creation failed: {}\", e.getMessage(), e.getCause());\n}","preventionTips":["Verify the broker has transactions enabled (transactionCoordinatorEnabled=true) before using transactions","Check the client is open before creating transactions","Prefer newTransactionAsync() in async code to avoid blocking/unwrapping"],"tags":["transactions","async","broker"],"backgroundTag":"transaction-creation-failed","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"}