apache/pulsar · error · PulsarAdminException
Resource group does not exist: ${name}
Error message
Resource group does not exist: ${name} What it means
resourceGroupDelete throws PulsarAdminException when no resource group exists under the given name. Deletion requires an existing group; the follow-on check (error on tenant/namespace refs) only runs for existing groups.
Source
Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupService.java:165
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);
}
long tenantRefCount = rg.getResourceGroupNumOfTenantRefs();
long nsRefCount = rg.getResourceGroupNumOfNSRefs();
if ((tenantRefCount + nsRefCount) > 0) {
String errMesg = "Resource group " + name + " still has " + tenantRefCount + " tenant refs";
errMesg += " and " + nsRefCount + " namespace refs on it";
throw new PulsarAdminException(errMesg);
}
rg.resourceGroupPublishLimiter = null;
resourceGroupsMap.remove(name);
}
/**
* Get the current number of RGs. For testing.
*/
protected long getNumResourceGroups() {View on GitHub (pinned to 820761864e)
Solutions
- Verify the group exists with resourceGroupGet before deleting; treat not-found as success in idempotent cleanup.
- Check the exact name spelling and target cluster.
- If deletion races with another actor, catch PulsarAdminException with this message and continue.
- If the group exists but delete still fails for refs, first remove tenant/namespace references (see the still-has-tenant-refs error).
Example fix
// before
svc.resourceGroupDelete("rg1"); // fails if rg1 absent
// after
try {
svc.resourceGroupDelete("rg1");
} catch (PulsarAdminException e) {
if (!e.getMessage().contains("does not exist")) throw e; // idempotent delete
} Defensive patterns
Strategy: validation
Validate before calling
if (!svc.resourceGroupGetAll().contains(name)) {
return; // already gone; treat delete as idempotent no-op
} Try / catch
try {
svc.resourceGroupDelete(name);
} catch (PulsarAdminException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Resource group does not exist")) {
log.info("Resource group {} already deleted; ignoring", name);
} else throw e;
} Prevention
- Check existence before delete; skip if already absent
- Treat delete retries carefully to avoid double-delete noise
- Confirm the exact name and cluster before cleanup scripts run
- Remove tenant/namespace refs before deleting an in-use group
When it happens
Trigger: Calling resourceGroupDelete(name) when getResourceGroupInternal(name) returns null — the group was never created, already deleted, or the name is wrong.
Common situations: Double-delete from retry logic; typo in the name; deleting on the wrong cluster; cleanup scripts assuming groups exist from a prior environment.
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
- Resource group does not exist: ${rgName}
- Unexpected monitoring class: ${monClass}
- ResourceGroupUpdate: Invalid null ResourceGroup config
- Cannot start the service once it was stopped
- webServicePort/webServicePortTls or http/https bindAddresses
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/e4c0569951c7bb23.
Report an issue: GitHub.