{"record":{"id":"150a570314658019","repo":"apache/pulsar","slug":"cause-getmessage-150a57","errorCode":null,"errorMessage":"${cause.getMessage()}","messagePattern":"\\$\\{cause\\.getMessage\\(\\)\\}","errorType":"exception","errorClass":"org.apache.pulsar.client.impl.v5.PulsarClientException.NotFoundException","httpStatus":null,"severity":"error","filePath":"pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/ProducerBuilderV5.java","lineNumber":63,"sourceCode":"    private final Schema<T> v5Schema;\n    private final ProducerConfigurationData conf = new ProducerConfigurationData();\n\n    ProducerBuilderV5(PulsarClientV5 client, Schema<T> v5Schema) {\n        this.client = client;\n        this.v5Schema = v5Schema;\n    }\n\n    @Override\n    public Producer<T> create() throws PulsarClientException {\n        try {\n            return createAsync().join();\n        } catch (java.util.concurrent.CompletionException e) {\n            Throwable cause = e.getCause();\n            if (cause instanceof PulsarClientException pce) {\n                throw pce;\n            }\n            if (cause instanceof org.apache.pulsar.client.api.PulsarClientException.NotFoundException) {\n                throw new PulsarClientException.NotFoundException(cause.getMessage());\n            }\n            throw new PulsarClientException(cause);\n        }\n    }\n\n    @Override\n    public CompletableFuture<Producer<T>> createAsync() {\n        String topicStr = conf.getTopicName();\n        if (topicStr == null || topicStr.isEmpty()) {\n            return CompletableFuture.failedFuture(\n                    new PulsarClientException.InvalidConfigurationException(\"Topic name is required\"));\n        }\n\n        TopicName topicName = V5Utils.parseScalableTopicInput(topicStr);\n\n        // Create DAG watch client and start the session\n        DagWatchClient dagWatch = new DagWatchClient(client.v4Client(), topicName);\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/ProducerBuilderV5.java#L45-L81","documentation":"Thrown by ProducerBuilderV5.create() when the underlying async producer creation completes exceptionally. PulsarClientException subtypes are rethrown as-is; any other cause is wrapped in a plain PulsarClientException (or NotFoundException when it matches). The message is the cause's message.","triggerScenarios":"create() called on a builder whose async path failed — invalid topic name, broker unreachable, authentication failure, namespace/topic not found, or producer name conflicts.","commonSituations":"Typo in topic URL; broker down or wrong serviceUrl; missing auth credentials; topic auto-creation disabled and topic absent.","solutions":["Read the wrapped cause message to identify the root failure","Verify the topic name and serviceUrl configuration","Check auth plugin/credentials are set correctly","Enable topic auto-creation or create the topic before producing"],"exampleFix":"// before\nProducer<String> p = client.newProducer(Schema.STRING).create();\n// after\ntry {\n    Producer<String> p = client.newProducer(Schema.STRING).topic(topic).create();\n} catch (PulsarClientException.NotFoundException e) {\n    // topic does not exist — create it or enable auto-creation\n}","handlingStrategy":"try-catch","validationCode":"// validate before create\nObjects.requireNonNull(topic, \"topic required\");\nif (!topic.startsWith(\"persistent://\") && !topic.startsWith(\"non-persistent://\") && !topic.matches(\"[\\w/-]+\")) { throw new IllegalArgumentException(\"bad topic: \" + topic); }","typeGuard":null,"tryCatchPattern":"try { producer = builder.create(); } catch (PulsarClientException.NotFoundException e) { /* topic missing */ } catch (PulsarClientException e) { log.error(\"producer create failed: {}\", e.getMessage()); }","preventionTips":["Validate topic names and serviceUrl before create","Verify auth configuration before client creation","Enable topic auto-creation or pre-create topics"],"tags":["pulsar","client","producer","creation-failure"],"backgroundTag":"producer-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"}