apache/pulsar · error · RestException

Namespace policies does not exist

Error message

Namespace policies does not exist

What it means

Thrown when the namespace's policy ZooKeeper node is missing while reading policies (e.g. the replicator dispatch-rate getter), meaning the namespace was never created or its policies were deleted; the admin operation cannot proceed without an existing namespace.

Source

Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:3252

                }).exceptionally(ex -> {
                    resumeAsyncResponseExceptionally(asyncResponse, ex);
                    log.error()
                            .attr("namespace", namespaceName)
                            .exception(ex)
                            .log("Failed to update the replicatorDispatchRate for cluster on namespace");
                    return null;
                });
    }
    /**
     * Base method for getReplicatorDispatchRate v1 and v2.
     * Notion: don't re-use this logic.
     */
    protected void internalGetReplicatorDispatchRate(AsyncResponse asyncResponse) {
        validateNamespacePolicyOperationAsync(namespaceName, PolicyName.REPLICATION_RATE, PolicyOperation.READ)
                .thenCompose(__ -> namespaceResources().getPoliciesAsync(namespaceName))
                .thenApply(policiesOpt -> {
                    if (!policiesOpt.isPresent()) {
                        throw new RestException(Response.Status.NOT_FOUND, "Namespace policies does not exist");
                    }
                    String clusterName = pulsar().getConfiguration().getClusterName();
                    return policiesOpt.get().replicatorDispatchRate.get(clusterName);
                }).thenAccept(asyncResponse::resume)
                .exceptionally(ex -> {
                    resumeAsyncResponseExceptionally(asyncResponse, ex);
                    log.error()
                            .attr("namespace", namespaceName)
                            .exception(ex)
                            .log("Failed to get replicator dispatch-rate configured for the namespace");
                    return null;
                });
    }
    /**
     * Base method for removeReplicatorDispatchRate v1 and v2.
     * Notion: don't re-use this logic.
     */
    protected void internalRemoveReplicatorDispatchRate(AsyncResponse asyncResponse) {

View on GitHub (pinned to 820761864e)

Solutions

  1. Create the namespace before applying policies
  2. Check whether another client concurrently deleted the namespace and retry with a valid one
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:3252 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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