apache/pulsar · error · RestException

Partitioned Topic not found: %s %s

Error message

Partitioned Topic not found: %s %s

What it means

topicNotFoundReasonAsync: the requested partitioned topic has no metadata in the metadata store (or zero partitions), so the partitioned topic does not exist; reported as NOT_FOUND with the formatted topic/type pair.

Source

Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:4711

        return pulsar().getBrokerService().getTopicIfExists(topicName.toString())
                .thenCompose(optTopic -> optTopic
                        .map(CompletableFuture::completedFuture)
                        .orElseGet(() -> topicNotFoundReasonAsync(topicName)));
    }

    private CompletableFuture<Topic> topicNotFoundReasonAsync(TopicName topicName) {
        if (!topicName.isPartitioned()) {
            return FutureUtil.failedFuture(new RestException(Status.NOT_FOUND,
                    getTopicNotFoundErrorMessage(topicName.toString())));
        }

        return getPartitionedTopicMetadataAsync(
                TopicName.get(topicName.getPartitionedTopicName()), false, false)
                .thenAccept(partitionedTopicMetadata -> {
                    if (partitionedTopicMetadata == null || partitionedTopicMetadata.partitions == 0) {
                        final String topicErrorType = partitionedTopicMetadata
                                == null ? "has no metadata" : "has zero partitions";
                        throw new RestException(Status.NOT_FOUND, String.format(
                                "Partitioned Topic not found: %s %s", topicName.toString(), topicErrorType));
                    }
                })
                .thenCompose(__ -> internalGetListAsync(Optional.empty(), null))
                .thenApply(topics -> {
                    if (!topics.contains(topicName.toString())) {
                        throw new RestException(Status.NOT_FOUND, "Topic partitions were not yet created");
                    }
                    throw new RestException(Status.NOT_FOUND,
                        getPartitionedTopicNotFoundErrorMessage(topicName.toString()));
            });
    }

    /**
     * Find the subscription or create it when automatic subscription creation is allowed.
     */
    private CompletableFuture<Subscription> findOrCreateSubscriptionAsync(String subName, PersistentTopic topic) {
        Subscription subscription = topic.getSubscription(subName);

View on GitHub (pinned to 820761864e)

Solutions

  1. Create the partitioned topic with a positive partition count
  2. Check the topic name spelling and namespace
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:4711 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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