{"record":{"id":"e0a8c7e5e412be36","repo":"apache/pulsar","slug":"e-e0a8c7","errorCode":null,"errorMessage":"e","messagePattern":"e","errorType":"http","errorClass":"RestException","httpStatus":500,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/ResourceGroupsBase.java","lineNumber":37,"sourceCode":"package org.apache.pulsar.broker.admin.impl;\n\nimport jakarta.ws.rs.core.Response;\nimport java.util.List;\nimport org.apache.pulsar.broker.admin.AdminResource;\nimport org.apache.pulsar.broker.web.RestException;\nimport org.apache.pulsar.common.naming.NamespaceName;\nimport org.apache.pulsar.common.policies.data.Policies;\nimport org.apache.pulsar.common.policies.data.ResourceGroup;\nimport org.apache.pulsar.metadata.api.MetadataStoreException;\n\npublic abstract class ResourceGroupsBase extends AdminResource {\n    protected List<String> internalGetResourceGroups() {\n        try {\n            validateSuperUserAccess();\n            return resourceGroupResources().listResourceGroups();\n        } catch (Exception e) {\n            log.error().exception(e).log(\"Failed to get ResourceGroups list\");\n            throw new RestException(e);\n        }\n    }\n\n    protected ResourceGroup internalGetResourceGroup(String rgName) {\n        try {\n            validateSuperUserAccess();\n            ResourceGroup resourceGroup = resourceGroupResources().getResourceGroup(rgName)\n                    .orElseThrow(() -> new RestException(Response.Status.NOT_FOUND, \"ResourceGroup does not exist\"));\n            return resourceGroup;\n        } catch (RestException re) {\n            throw re;\n        } catch (Exception e) {\n            log.error()\n                    .attr(\"resourceGroup\", rgName)\n                    .exception(e)\n                    .log(\"Failed to get ResourceGroup\");\n            throw new RestException(e);\n        }","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/ResourceGroupsBase.java#L19-L55","documentation":"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.","triggerScenarios":"GET /admin/v3/resourcegroups (internalGetResourceGroups) when the metadata store read fails, the store session is lost, or validateSuperUserAccess() throws an unexpected (non-RestException) exception.","commonSituations":"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.","solutions":["Check the broker log line 'Failed to get ResourceGroups list' for the wrapped cause.","Verify the configuration/metadata store (e.g. ZooKeeper) is reachable and the broker session is healthy.","Ensure the calling principal is a super-user (check authentication/authorization configuration).","Retry the request once the metadata store connection recovers."],"exampleFix":"// before\ntry {\n    return client.resourcegroups().list();\n} catch (PulsarAdminException e) {\n    throw e; // 500 with no detail\n}\n// after\ntry {\n    return client.resourcegroups().list();\n} catch (PulsarAdminException e) {\n    log.error(\"Listing resource groups failed\", e); // inspect cause: store connectivity/permissions\n    throw e;\n}","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n    List<String> groups = admin.resourcegroups().list();\n} catch (PulsarAdminException e) {\n    if (e.getStatusCode() >= 500) retryWithBackoff(); // transient store issue\n    else throw e;\n}","preventionTips":["Monitor metadata store connectivity before issuing admin calls.","Retry 5xx admin responses with backoff; they are often transient store errors.","Confirm the client principal is a super-user before listing."],"tags":["rest-api","metadata-store","resourcegroups","internal-server-error"],"backgroundTag":"metadata-store-unavailable","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}