apache/pulsar · warning · RestException

NamespaceIsolationPolicies for cluster ${cluster} does not e

Error message

NamespaceIsolationPolicies for cluster ${cluster} does not exist

What it means

HTTP 404 (NOT_FOUND) thrown by internalGetNamespaceIsolationPolicies when no NamespaceIsolationPolicies metadata record exists for the cluster at all. Unlike error 74 the cluster exists, but no policy data was ever persisted for it (empty means 'never configured', which this path treats as missing). Callers are the isolation-policy GET endpoints.

Source

Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/ClustersBase.java:593

     * 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}")
    @Operation(
            summary = "Get the single namespace isolation policy assigned to the cluster.",
            description = "This operation requires Pulsar superuser privileges."
    )
    @ApiResponses(value = {
            @ApiResponse(responseCode = "200",
                    description = "Get the single namespace isolation policy assigned to the cluster.",
                    content = @Content(schema = @Schema(implementation = NamespaceIsolationDataImpl.class))),
            @ApiResponse(responseCode = "403", description = "Don't have admin permission."),
            @ApiResponse(responseCode = "404", description = "Policy doesn't exist."),

View on GitHub (pinned to 820761864e)

Solutions

  1. Set an initial isolation policy with POST /admin/v3/clusters/{cluster}/namespaceIsolationPolicies/{policyName} so the record exists, then re-read.
  2. Treat 404 as 'no policies configured' in client code instead of an error.
  3. Verify you queried the correct cluster where policies were actually configured.

Example fix

// before
Map<String, NamespaceIsolationDataImpl> policies = admin.namespaces().getNamespaceIsolationPolicies(cluster); // 404
// after
Map<String, NamespaceIsolationDataImpl> policies;
try {
    policies = admin.namespaces().getNamespaceIsolationPolicies(cluster);
} catch (PulsarAdminException.NotFoundException e) {
    policies = Collections.emptyMap();
}
Defensive patterns

Strategy: try-catch

Try / catch

Map<String, NamespaceIsolationData> policies;
try {
    policies = admin.namespaces().getNamespaceIsolationPolicies(cluster);
} catch (PulsarAdminException.NotFoundException e) {
    policies = Collections.emptyMap(); // no policies configured yet
}

Prevention

When it happens

Trigger: GET /admin/v3/clusters/{cluster}/namespaceIsolationPolicies on a cluster where no isolation policy was ever set (no IsolationData written to metadata); querying a freshly created cluster.

Common situations: Monitoring scripts expecting an empty map but receiving 404 on unconfigured clusters; reading isolation config from a cluster that is still brand-new; migration tooling assuming policies exist everywhere.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/4d638a2c02631840. Report an issue: GitHub.