{"record":{"id":"818d182272f0f05a","repo":"apache/pulsar","slug":"analyze-backlog-on-a-partitioned-topic-is-not-allo","errorCode":null,"errorMessage":"Analyze backlog on a partitioned topic is not allowed, please try do it on specific topic partition","messagePattern":"Analyze backlog on a partitioned topic is not allowed, please try do it on specific topic partition","errorType":"http","errorClass":"RestException","httpStatus":405,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java","lineNumber":2634,"sourceCode":"            resumeAsyncResponseExceptionally(asyncResponse, ex);\n            return null;\n        });\n    }\n\n    protected void internalAnalyzeSubscriptionBacklog(AsyncResponse asyncResponse, String subName,\n                                                      Optional<Position> position,\n                                                      boolean authoritative) {\n        validateTopicOperationAsync(topicName, TopicOperation.CONSUME, subName)\n        .thenCompose(__ -> validateGlobalNamespaceOwnershipAsync(namespaceName))\n        .thenCompose(__ -> validateTopicOwnershipAsync(topicName, authoritative))\n                .thenCompose(__ -> {\n                    if (topicName.isPartitioned()) {\n                        return CompletableFuture.completedFuture(null);\n                    } else {\n                        return getPartitionedTopicMetadataAsync(topicName, authoritative, false)\n                                .thenAccept(metadata -> {\n                                    if (metadata.partitions > 0) {\n                                        throw new RestException(Status.METHOD_NOT_ALLOWED,\n                                                \"Analyze backlog on a partitioned topic is not allowed, \"\n                                                        + \"please try do it on specific topic partition\");\n                                    }\n                                });\n                    }\n                })\n                .thenAccept(__ -> {\n                   internalAnalyzeSubscriptionBacklogForNonPartitionedTopic(asyncResponse, subName,\n                           position, authoritative);\n                })\n                .exceptionally(ex -> {\n                    // If the exception is not redirect exception we need to log it.\n                    if (isNot307And404Exception(ex)) {\n                        log.error()\n                                .attr(\"subscription\", subName)\n                                .attr(\"topic\", topicName)\n                                .exception(ex)\n                                .log(\"Failed to analyze back log of subscription from topic\");","sourceCodeStart":2616,"sourceCodeEnd":2652,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L2616-L2652","documentation":"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.","triggerScenarios":"Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:2634 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the analyze operation against a specific partition (topic-partition-N)","Iterate partitions and aggregate results client-side"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}