apache/pulsar · error · org.apache.pulsar.client.impl.v5.PulsarClientException.NotFoundException
${cause.getMessage()}
Error message
${cause.getMessage()} What it means
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.
Source
Thrown at pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/ProducerBuilderV5.java:63
private final Schema<T> v5Schema;
private final ProducerConfigurationData conf = new ProducerConfigurationData();
ProducerBuilderV5(PulsarClientV5 client, Schema<T> v5Schema) {
this.client = client;
this.v5Schema = v5Schema;
}
@Override
public Producer<T> create() throws PulsarClientException {
try {
return createAsync().join();
} catch (java.util.concurrent.CompletionException e) {
Throwable cause = e.getCause();
if (cause instanceof PulsarClientException pce) {
throw pce;
}
if (cause instanceof org.apache.pulsar.client.api.PulsarClientException.NotFoundException) {
throw new PulsarClientException.NotFoundException(cause.getMessage());
}
throw new PulsarClientException(cause);
}
}
@Override
public CompletableFuture<Producer<T>> createAsync() {
String topicStr = conf.getTopicName();
if (topicStr == null || topicStr.isEmpty()) {
return CompletableFuture.failedFuture(
new PulsarClientException.InvalidConfigurationException("Topic name is required"));
}
TopicName topicName = V5Utils.parseScalableTopicInput(topicStr);
// Create DAG watch client and start the session
DagWatchClient dagWatch = new DagWatchClient(client.v4Client(), topicName);
View on GitHub (pinned to 820761864e)
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
Example fix
// before
Producer<String> p = client.newProducer(Schema.STRING).create();
// after
try {
Producer<String> p = client.newProducer(Schema.STRING).topic(topic).create();
} catch (PulsarClientException.NotFoundException e) {
// topic does not exist — create it or enable auto-creation
} Defensive patterns
Strategy: try-catch
Validate before calling
// validate before create
Objects.requireNonNull(topic, "topic required");
if (!topic.startsWith("persistent://") && !topic.startsWith("non-persistent://") && !topic.matches("[\w/-]+")) { throw new IllegalArgumentException("bad topic: " + topic); } Try / catch
try { producer = builder.create(); } catch (PulsarClientException.NotFoundException e) { /* topic missing */ } catch (PulsarClientException e) { log.error("producer create failed: {}", e.getMessage()); } Prevention
- Validate topic names and serviceUrl before create
- Verify auth configuration before client creation
- Enable topic auto-creation or pre-create topics
When it happens
Trigger: create() called on a builder whose async path failed — invalid topic name, broker unreachable, authentication failure, namespace/topic not found, or producer name conflicts.
Common situations: Typo in topic URL; broker down or wrong serviceUrl; missing auth credentials; topic auto-creation disabled and topic absent.
Related errors
- Try to reserve/release memory failed, the param memorySize i
- Failed to decode message from topic ${topic} with schemaId $
- When 'messageRoutingMode' is CustomPartition, 'messageRouter
- When 'messageRouter' is set, 'messageRoutingMode' should be
- Cannot set resourceTypes when shareConfigured() has already
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/150a570314658019.
Report an issue: GitHub.