{"record":{"id":"add2fc4821b8be59","repo":"apache/pulsar","slug":"allowed-clusters-do-not-contain-the-replication-cl","errorCode":null,"errorMessage":"Allowed clusters do not contain the replication cluster %s. Please remove the replication cluster if the cluster is not allowed for this namespace","messagePattern":"Allowed clusters do not contain the replication cluster (.+?)\\. Please remove the replication cluster if the cluster is not allowed for this namespace","errorType":"http","errorClass":"RestException","httpStatus":400,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java","lineNumber":3429,"sourceCode":"                    }\n                    return policiesOpt.map(p -> p.dispatcherPauseOnAckStatePersistentEnabled).orElse(false);\n                });\n    }\n\n    protected CompletableFuture<Void> internalSetNamespaceAllowedClusters(List<String> clusterIds) {\n        return validateNamespacePolicyOperationAsync(namespaceName, PolicyName.ALLOW_CLUSTERS, PolicyOperation.WRITE)\n                .thenCompose(__ -> validatePoliciesReadOnlyAccessAsync())\n                // Allowed clusters in the namespace policy should be included in the allowed clusters in the tenant\n                // policy.\n                .thenCompose(__ -> FutureUtil.waitForAll(clusterIds.stream().map(clusterId ->\n                        validateClusterForTenantAsync(namespaceName.getTenant(), clusterId))\n                        .collect(Collectors.toList())))\n                .thenCompose(__ -> {\n                    checkNotNull(clusterIds, \"ClusterIds should not be null\");\n                    return getNamespacePoliciesAsync(this.namespaceName).thenApply(nsPolicies -> {\n                        Set<String> clusterSet = Sets.newHashSet(clusterIds);\n                        if (!Policies.checkNewAllowedClusters(nsPolicies, clusterSet)){\n                            throw new RestException(Status.BAD_REQUEST,\n                                    String.format(\"Allowed clusters do not contain the replication cluster %s. \"\n                                        + \"Please remove the replication cluster if the cluster is not allowed \"\n                                        + \"for this namespace\", nsPolicies.replication_clusters));\n                        }\n                        return clusterSet;\n                    });\n                })\n                // Verify the allowed clusters are valid and they do not contain the peer clusters.\n                .thenCompose(allowedClusters -> clustersAsync()\n                        .thenCompose(clusters -> {\n                            List<CompletableFuture<Void>> futures =\n                                    allowedClusters.stream().map(clusterId -> {\n                                        if (!clusters.contains(clusterId)) {\n                                            throw new RestException(Status.FORBIDDEN,\n                                                    \"Invalid cluster id: \" + clusterId);\n                                        }\n                                        return validatePeerClusterConflictAsync(clusterId, allowedClusters);\n                                    }).collect(Collectors.toList());","sourceCodeStart":3411,"sourceCodeEnd":3447,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java#L3411-L3447","documentation":"internalSetNamespaceAllowedClusters rejects adding a replication cluster to the namespace that is not part of the tenant's allowedClusters list; this is a tenant/namespace consistency precondition failure (412).","triggerScenarios":"Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:3429 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the cluster to the tenant's allowedClusters first, then set namespace replication clusters","Remove the disallowed cluster from the namespace's replicationClusters set"],"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-14T05:17:10.506Z"}