apache/pulsar · error · RestException

e

Error message

e

What it means

This is a generic RestException wrapping any unexpected Exception thrown while listing resource groups via the admin API. The handler validated super-user access and called listResourceGroups(); any failure (typically a metadata store problem) is caught, logged as 'Failed to get ResourceGroups list', and rethrown as a 500 RestException whose cause is the original exception. Inspect the server log and the wrapped cause for the real error.

Source

Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/ResourceGroupsBase.java:37

package org.apache.pulsar.broker.admin.impl;

import jakarta.ws.rs.core.Response;
import java.util.List;
import org.apache.pulsar.broker.admin.AdminResource;
import org.apache.pulsar.broker.web.RestException;
import org.apache.pulsar.common.naming.NamespaceName;
import org.apache.pulsar.common.policies.data.Policies;
import org.apache.pulsar.common.policies.data.ResourceGroup;
import org.apache.pulsar.metadata.api.MetadataStoreException;

public abstract class ResourceGroupsBase extends AdminResource {
    protected List<String> internalGetResourceGroups() {
        try {
            validateSuperUserAccess();
            return resourceGroupResources().listResourceGroups();
        } catch (Exception e) {
            log.error().exception(e).log("Failed to get ResourceGroups list");
            throw new RestException(e);
        }
    }

    protected ResourceGroup internalGetResourceGroup(String rgName) {
        try {
            validateSuperUserAccess();
            ResourceGroup resourceGroup = resourceGroupResources().getResourceGroup(rgName)
                    .orElseThrow(() -> new RestException(Response.Status.NOT_FOUND, "ResourceGroup does not exist"));
            return resourceGroup;
        } catch (RestException re) {
            throw re;
        } catch (Exception e) {
            log.error()
                    .attr("resourceGroup", rgName)
                    .exception(e)
                    .log("Failed to get ResourceGroup");
            throw new RestException(e);
        }

View on GitHub (pinned to 820761864e)

Solutions

  1. Check the broker log line 'Failed to get ResourceGroups list' for the wrapped cause.
  2. Verify the configuration/metadata store (e.g. ZooKeeper) is reachable and the broker session is healthy.
  3. Ensure the calling principal is a super-user (check authentication/authorization configuration).
  4. Retry the request once the metadata store connection recovers.

Example fix

// before
try {
    return client.resourcegroups().list();
} catch (PulsarAdminException e) {
    throw e; // 500 with no detail
}
// after
try {
    return client.resourcegroups().list();
} catch (PulsarAdminException e) {
    log.error("Listing resource groups failed", e); // inspect cause: store connectivity/permissions
    throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

try {
    List<String> groups = admin.resourcegroups().list();
} catch (PulsarAdminException e) {
    if (e.getStatusCode() >= 500) retryWithBackoff(); // transient store issue
    else throw e;
}

Prevention

When it happens

Trigger: GET /admin/v3/resourcegroups (internalGetResourceGroups) when the metadata store read fails, the store session is lost, or validateSuperUserAccess() throws an unexpected (non-RestException) exception.

Common situations: ZooKeeper/metadata store outage or session expiry during an admin listing call; broker unable to reach the configuration store; caller lacking super-user role in a misconfigured authentication setup.

Related errors


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