apache/pulsar · error · RestException

Topic's namespace does not exist

Error message

Topic's namespace does not exist

What it means

During grantPermissionsAsync on a topic, namespace-existence validation failed: the topic's namespace does not exist (never created or deleted), so permission granting cannot continue and a 404 is surfaced.

Source

Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:251

        AuthorizationService authService = pulsar().getBrokerService().getAuthorizationService();
        if (null != authService) {
            return authService.grantPermissionAsync(topicUri, actions, role, null/*additional auth-data json*/)
                    .thenAccept(__ -> log.info()
                            .attr("role", role)
                            .attr("actions", actions)
                            .attr("topic", topicUri)
                            .log("Successfully granted access for role on topic"))
                    .exceptionally(ex -> {
                        Throwable realCause = FutureUtil.unwrapCompletionException(ex);
                        //The IllegalArgumentException and the IllegalStateException were historically thrown by the
                        // grantPermissionAsync method, so we catch them here to ensure backwards compatibility.
                        if (realCause instanceof MetadataStoreException.NotFoundException
                                || realCause instanceof IllegalArgumentException) {
                            log.warn()
                                    .attr("topic", topicUri)
                                    .exception(realCause)
                                    .log("Failed to set permissions for topic: Namespace does not exist");
                            throw new RestException(Status.NOT_FOUND, "Topic's namespace does not exist");
                        } else if (realCause instanceof MetadataStoreException.BadVersionException
                                || realCause instanceof IllegalStateException) {
                            log.warn()
                                    .attr("topic", topicUri)
                                    .exceptionMessage(realCause)
                                    .log("Failed to set permissions for topic");
                            throw new RestException(Status.CONFLICT, "Concurrent modification");
                        } else {
                            log.error()
                                    .attr("topic", topicUri)
                                    .exceptionMessage(realCause)
                                    .log("Failed to get permissions for topic");
                            throw new RestException(realCause);
                        }
                    });
        } else {
            String msg = "Authorization is not enabled";
            return FutureUtil.failedFuture(new RestException(Status.NOT_IMPLEMENTED, msg));

View on GitHub (pinned to 820761864e)

Solutions

  1. Confirm the namespace exists and retry the grant
  2. Fix the topic URI tenant/namespace segments
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:251 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/42d867c6596ab019. Report an issue: GitHub.