apache/pulsar · error · RestException
Cluster ${cluster} does not exist.
Error message
Cluster ${cluster} does not exist. What it means
HTTP error (status depends on the caller's notExistStatus parameter, typically 412 PRECONDITION_FAILED) thrown by validateClusterExistAsync when the target cluster does not exist in metadata. It guards all namespace-isolation and broker-isolation endpoints before they read or write cluster-scoped data. Called by getNamespaceIsolationPolicies, getNamespaceIsolationPolicy, broker listing, and set/delete isolation policy.
Source
Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/ClustersBase.java:583
.attr("cluster", cluster)
.exception(ex)
.log("Failed to get namespace isolation policies");
resumeAsyncResponseExceptionally(asyncResponse, ex);
return null;
});
}
/**
* Verify that the cluster exists.
* For compatibility to avoid breaking changes, we can specify a REST status code when it doesn't exist.
* @param cluster Cluster name
* @param notExistStatus REST status code
*/
private CompletableFuture<Void> validateClusterExistAsync(String cluster, Status notExistStatus) {
return clusterResources().clusterExistsAsync(cluster)
.thenAccept(clusterExist -> {
if (!clusterExist) {
throw new RestException(notExistStatus, "Cluster " + cluster + " does not exist.");
}
});
}
private CompletableFuture<Map<String, NamespaceIsolationDataImpl>> internalGetNamespaceIsolationPolicies(
String cluster) {
return namespaceIsolationPolicies().getIsolationDataPoliciesAsync(cluster)
.thenApply(namespaceIsolationPolicies -> {
if (!namespaceIsolationPolicies.isPresent()) {
throw new RestException(Status.NOT_FOUND,
"NamespaceIsolationPolicies for cluster " + cluster + " does not exist");
}
return namespaceIsolationPolicies.get().getPolicies();
});
}
@GET
@Path("/{cluster}/namespaceIsolationPolicies/{policyName}")View on GitHub (pinned to 820761864e)
Solutions
- Verify the cluster exists: GET /admin/v3/clusters/{cluster} (or GET /admin/v3/clusters to list all) and fix the name.
- Create the missing cluster first with POST /admin/v3/clusters/{cluster} if it is genuinely needed.
- Use the exact, case-sensitive cluster name as registered (e.g. "us-east" not "US-East").
Example fix
// before
admin.namespaces().getNamespaceIsolationPolicies("east-1"); // fails if not created
// after
if (admin.clusters().getClusters().contains("east-1")) {
admin.namespaces().getNamespaceIsolationPolicies("east-1");
} else {
throw new IllegalStateException("Cluster east-1 must be created first");
} Defensive patterns
Strategy: validation
Validate before calling
List<String> clusters = admin.clusters().getClusters();
if (!clusters.contains(cluster)) {
throw new IllegalArgumentException("Cluster " + cluster + " does not exist; existing: " + clusters);
}
admin.namespaces().getNamespaceIsolationPolicies(cluster); Try / catch
try {
admin.namespaces().getNamespaceIsolationPolicies(cluster);
} catch (PulsarAdminException e) {
if (e.getStatusCode() == 412) {
// cluster does not exist: create it or correct the name
}
throw e;
} Prevention
- Verify cluster names against GET /admin/v3/clusters before calling isolation endpoints.
- Use shared, typed constants for cluster names rather than free-form strings.
- Create clusters before running per-cluster policy/broker tooling.
When it happens
Trigger: GET/POST/DELETE on /admin/v3/clusters/{cluster}/namespaceIsolationPolicies (or /brokersWithNamespaceIsolationPolicy) with a cluster name not present in metadata; typos in cluster name; querying isolation policies of a decommissioned cluster.
Common situations: Automation hitting a wrong-environment cluster name; running isolation-policy scripts before cluster creation; stale config after a cluster was renamed.
Related errors
- The offloadPolicies must be specified for namespace offload.
- The bucket must be specified for namespace offload.
- cluster data is required
- Peer cluster ${peerCluster} does not exist
- Cluster not empty
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/45dac66d419f73a1.
Report an issue: GitHub.