apache/pulsar · error · PulsarAdminException

Resource group does not exist: ${rgName}

Error message

Resource group does not exist: ${rgName}

What it means

resourceGroupUpdate looks up the named resource group before applying the update and found none registered in the broker's resource-group map, so the update is rejected — the RG must be created first.

Source

Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupService.java:147

        // Return a copy.
        return new ResourceGroup(retrievedRG);
    }

    /**
     * Update RG.
     *
     * @throws if RG with that name does not exist.
     */
    public void resourceGroupUpdate(String rgName, org.apache.pulsar.common.policies.data.ResourceGroup rgConfig)
      throws PulsarAdminException {
        if (rgConfig == null) {
            throw new IllegalArgumentException("ResourceGroupUpdate: Invalid null ResourceGroup config");
        }

        ResourceGroup rg = this.getResourceGroupInternal(rgName);
        if (rg == null) {
            throw new PulsarAdminException("Resource group does not exist: " + rgName);
        }
        rg.updateResourceGroup(rgConfig);
        rgUpdates.labels(rgName).inc();
    }

    public Set<String> resourceGroupGetAll() {
        return resourceGroupsMap.keySet();
    }

    /**
     * Delete RG.
     *
     * @throws if RG with that name does not exist, or if the RG exists but is still in use.
     */
    public void resourceGroupDelete(String name) throws PulsarAdminException {
        ResourceGroup rg = this.getResourceGroupInternal(name);
        if (rg == null) {
            throw new PulsarAdminException("Resource group does not exist: " + name);

View on GitHub (pinned to 820761864e)

Solutions

  1. Create the resource group first
  2. Verify the RG name and that it is visible on this broker

Example fix

// before
svc.resourceGroupUpdate("rg1", cfg); // rg1 never created
// after
if (svc.getResourceGroup("rg1") == null) {
  svc.resourceGroupCreate("rg1", cfg);
} else {
  svc.resourceGroupUpdate("rg1", cfg);
}
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = svc.resourceGroupGetAll().contains(rgName);
if (!exists) {
  svc.resourceGroupCreate(rgName, rgConfig); // create-then-update
} else {
  svc.resourceGroupUpdate(rgName, rgConfig);
}

Try / catch

try {
  svc.resourceGroupUpdate(rgName, rgConfig);
} catch (PulsarAdminException e) {
  if (e.getMessage() != null && e.getMessage().startsWith("Resource group does not exist")) {
    svc.resourceGroupCreate(rgName, rgConfig); // upsert pattern
  } else throw e;
}

Prevention

When it happens

Trigger: Calling resourceGroupUpdate(rgName, cfg) where getResourceGroupInternal(rgName) returns null — the name was never created or was deleted (locally or on this cluster).

Common situations: Typo in the resource group name; update issued against a cluster where the group was never created; group deleted concurrently; running update before bootstrap populated policies.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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