apache/pulsar · error · RestException

Analyze backlog on a partitioned topic is not allowed, pleas

Error message

Analyze backlog on a partitioned topic is not allowed, please try do it on specific topic partition

What it means

internalAnalyzeSubscriptionBacklog rejects backlog analysis on a partitioned topic with 405: the analysis operates on a single managed ledger, so it must be invoked against a specific non-partitioned topic partition.

Source

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

            resumeAsyncResponseExceptionally(asyncResponse, ex);
            return null;
        });
    }

    protected void internalAnalyzeSubscriptionBacklog(AsyncResponse asyncResponse, String subName,
                                                      Optional<Position> position,
                                                      boolean authoritative) {
        validateTopicOperationAsync(topicName, TopicOperation.CONSUME, subName)
        .thenCompose(__ -> validateGlobalNamespaceOwnershipAsync(namespaceName))
        .thenCompose(__ -> validateTopicOwnershipAsync(topicName, authoritative))
                .thenCompose(__ -> {
                    if (topicName.isPartitioned()) {
                        return CompletableFuture.completedFuture(null);
                    } else {
                        return getPartitionedTopicMetadataAsync(topicName, authoritative, false)
                                .thenAccept(metadata -> {
                                    if (metadata.partitions > 0) {
                                        throw new RestException(Status.METHOD_NOT_ALLOWED,
                                                "Analyze backlog on a partitioned topic is not allowed, "
                                                        + "please try do it on specific topic partition");
                                    }
                                });
                    }
                })
                .thenAccept(__ -> {
                   internalAnalyzeSubscriptionBacklogForNonPartitionedTopic(asyncResponse, subName,
                           position, authoritative);
                })
                .exceptionally(ex -> {
                    // If the exception is not redirect exception we need to log it.
                    if (isNot307And404Exception(ex)) {
                        log.error()
                                .attr("subscription", subName)
                                .attr("topic", topicName)
                                .exception(ex)
                                .log("Failed to analyze back log of subscription from topic");

View on GitHub (pinned to 820761864e)

Solutions

  1. Run the analyze operation against a specific partition (topic-partition-N)
  2. Iterate partitions and aggregate results client-side
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:2634 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/818d182272f0f05a. Report an issue: GitHub.