apache/pulsar · error · IllegalArgumentException

ResourceGroupUpdate: Invalid null ResourceGroup config

Error message

ResourceGroupUpdate: Invalid null ResourceGroup config

What it means

ResourceGroupService.resourceGroupUpdate rejects a null ResourceGroup config with IllegalArgumentException before touching stored state. Updating a resource group requires a fully specified configuration object.

Source

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

    public ResourceGroup resourceGroupGet(String resourceGroupName) {
        ResourceGroup retrievedRG = this.getResourceGroupInternal(resourceGroupName);
        if (retrievedRG == null) {
            return null;
        }

        // 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.

View on GitHub (pinned to 820761864e)

Solutions

  1. Construct and populate a ResourceGroup config object before calling resourceGroupUpdate.
  2. In admin/REST paths, validate the request body is present and parses into a ResourceGroup before invoking the service.
  3. Check client serialization so the config isn't dropped during transport.
  4. Use resourceGroupGet or resourceGroupCreate if you intended to read or create rather than update.

Example fix

// before
admin.resourcegroups().updateResourceGroup("rg1", null);
// after
ResourceGroup cfg = new ResourceGroup();
cfg.setPublishRate(new PublishRate(1000, 10));
admin.resourcegroups().updateResourceGroup("rg1", cfg);
Defensive patterns

Strategy: validation

Validate before calling

java.util.Objects.requireNonNull(rgConfig, "ResourceGroup config must not be null");
// also check required fields
if (rgConfig.getPubRateInMsgs() <= 0 && rgConfig.getDispatchRateInMsgs() <= 0)
  log.warn("ResourceGroup config has no rates set");

Try / catch

try {
  svc.resourceGroupUpdate(rgName, rgConfig);
} catch (IllegalArgumentException e) {
  if (e.getMessage() != null && e.getMessage().contains("Invalid null ResourceGroup config")) {
    log.error("Config was null; check request body deserialization for " + rgName);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling resourceGroupUpdate(rgName, null), typically when admin code builds the config from a request body that was empty or failed to deserialize.

Common situations: Admin REST call with missing/empty JSON body mapped to null; programmatically constructing ResourceGroup config and forgetting to populate it; upstream deserialization failure silently yielding null.

Related errors


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