{"record":{"id":"e4f716477cf2699f","repo":"apache/pulsar","slug":"local-cluster-is-not-part-of-replicate-cluster-lis","errorCode":null,"errorMessage":"Local cluster is not part of replicate cluster list","messagePattern":"Local cluster is not part of replicate cluster list","errorType":"http","errorClass":"RestException","httpStatus":422,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java","lineNumber":504,"sourceCode":"                                    })\n                    );\n                }).thenCompose(__ -> {\n                    if (updateLocal) {\n                        return CompletableFuture.completedFuture(null);\n                    }\n                    // update remote cluster\n                    return getReplicationClusters()\n                            .thenCompose(replicationClusters -> {\n                                if (replicationClusters == null || replicationClusters.isEmpty()) {\n                                    return CompletableFuture.completedFuture(null);\n                                }\n                                boolean containsCurrentCluster =\n                                        replicationClusters.contains(pulsar().getConfig().getClusterName());\n                                if (!containsCurrentCluster) {\n                                    log.error()\n                                            .attr(\"namespace\", topicName)\n                                            .log(\"local cluster is not part of replicated cluster for namespace\");\n                                    throw new RestException(422,\n                                            \"Local cluster is not part of replicate cluster list\");\n                                }\n                                if (replicationClusters.size() == 1) {\n                                    // The replication clusters just has the current cluster itself.\n                                    return CompletableFuture.completedFuture(null);\n                                }\n                                // Do sync operation to other clusters.\n                                List<CompletableFuture<Void>> futures = replicationClusters.stream()\n                                        .map(replicationCluster -> admin.clusters().getClusterAsync(replicationCluster)\n                                                .thenCompose(clusterData -> pulsarService.getBrokerService()\n                                                    .getClusterPulsarAdmin(replicationCluster, Optional.of(clusterData))\n                                                        .topics().updatePartitionedTopicAsync(topicName.toString(),\n                                                            expectPartitions, true, force)\n                                                        .exceptionally(ex -> {\n                                                            log.warn()\n                                                                    .attr(\"topic\", topicName)\n                                                                    .attr(\"replicationCluster\", replicationCluster)\n                                                                    .exception(ex)","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L486-L522","documentation":"This 422 Unprocessable Entity is thrown when updating (increasing) a partitioned topic's partition count and the broker tries to propagate the update to all replication clusters of the topic. The local broker's cluster name is not present in the topic/namespace replication_clusters list, so the local cluster is not entitled to sync partition updates and refuses the operation. Pulsar requires the local cluster to be part of the replication set before performing cluster-wide partitioned-topic updates.","triggerScenarios":"Calling PUT /admin/v2/persistent/{ns}/{topic}/partitions (update-partitioned-topic / create-partitioned-topic with update-local flag false) on a broker whose cluster is not listed in the namespace's replication_clusters or the topic-level replication_clusters policy.","commonSituations":"Namespace configured with replication_clusters containing only remote clusters (e.g. clusters r1,r2 while calling the broker on cluster r3); a topic-level replication policy overriding the namespace list and dropping the local cluster; operating against the wrong cluster's broker service URL in a geo-replicated setup.","solutions":["Add the local cluster to the replication clusters: run `pulsar-admin namespaces set-replication-clusters <namespace> --clusters <list including local cluster>` (or set topic-level replication clusters with `pulsar-admin topics set-replication-clusters`).","Verify which cluster you are talking to: check `brokerServiceUrl`/`webServiceUrl` of the cluster you administer and confirm pulsar().getConfig().getClusterName() matches a cluster in the replication list.","If the update should stay local, invoke the update with the update-local flag set so remote sync is skipped where the API allows it.","Check for a stale topic-level policy that removed the local cluster and clear it with `pulsar-admin topics remove-replication-clusters`."],"exampleFix":"// before\npulsar-admin namespaces set-replication-clusters my-tenant/my-ns --clusters r1,r2\n// after\npulsar-admin namespaces set-replication-clusters my-tenant/my-ns --clusters r1,r2,local-cluster","handlingStrategy":"validation","validationCode":"final Set<String> replicationClusters = admin.namespaces().getReplicationClusters(namespace);\nfinal String localCluster = admin.clusters().getCluster(admin.clusters().getClusters().stream()\n        .filter(c -> true).findFirst().orElseThrow(), /* use broker config */).getName();\n// simpler: read from topic metadata before updating\nif (!replicationClusters.contains(localCluster)) {\n    throw new IllegalStateException(\"Add local cluster to replication clusters of \" + namespace);\n}\nadmin.topics().updatePartitionedTopicAsync(topic, newPartitions);","typeGuard":null,"tryCatchPattern":"try {\n    admin.topics().updatePartitionedTopic(topic, partitions);\n} catch (PulsarAdminException e) {\n    if (e.getStatusCode() == 422) {\n        // fix replication clusters then retry\n    } else throw e;\n}","preventionTips":["Always include the local cluster in replication_clusters when setting namespace policies","Verify cluster configuration before geo-replication admin operations","Use pulsar-admin namespaces get-replication-clusters to check before partition updates"],"tags":["pulsar","geo-replication","rest-api","configuration"],"backgroundTag":"cluster-not-in-replication-list","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"}