{"record":{"id":"6427ec7a9dff4b4d","repo":"apache/rocketmq","slug":"group-is-null","errorCode":null,"errorMessage":"group is null.","messagePattern":"group is null\\.","errorType":"exception","errorClass":"AuthorizationException","httpStatus":null,"severity":"error","filePath":"auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java","lineNumber":805,"sourceCode":"        result.addAll(newTopicSubContexts(metadata, topic));\n        return result;\n    }\n\n    private static List<DefaultAuthorizationContext> newTopicSubContexts(Metadata metadata,\n        apache.rocketmq.v2.Resource resource) {\n        return newSubContexts(metadata, ResourceType.TOPIC, resource);\n    }\n\n    private static List<DefaultAuthorizationContext> newGroupSubContexts(Metadata metadata,\n        apache.rocketmq.v2.Resource resource) {\n        return newSubContexts(metadata, ResourceType.GROUP, resource);\n    }\n\n    private static List<DefaultAuthorizationContext> newSubContexts(Metadata metadata, ResourceType resourceType,\n        apache.rocketmq.v2.Resource resource) {\n        if (resourceType == ResourceType.GROUP) {\n            if (resource == null || StringUtils.isBlank(resource.getName())) {\n                throw new AuthorizationException(\"group is null.\");\n            }\n            return newSubContexts(metadata, Resource.ofGroup(resource.getName()));\n        }\n        if (resourceType == ResourceType.TOPIC) {\n            if (resource == null || StringUtils.isBlank(resource.getName())) {\n                throw new AuthorizationException(\"topic is null.\");\n            }\n            return newSubContexts(metadata, Resource.ofTopic(resource.getName()));\n        }\n        throw new AuthorizationException(\"unknown resource type.\");\n    }\n\n    private static List<DefaultAuthorizationContext> newSubContexts(Metadata metadata, Resource resource) {\n        List<DefaultAuthorizationContext> result = new ArrayList<>();\n        Subject subject = null;\n        if (metadata.containsKey(GrpcConstants.AUTHORIZATION_AK)) {\n            subject = User.of(metadata.get(GrpcConstants.AUTHORIZATION_AK));\n        }","sourceCodeStart":787,"sourceCodeEnd":823,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/auth/src/main/java/org/apache/rocketmq/auth/authorization/builder/DefaultAuthorizationContextBuilder.java#L787-L823","documentation":"Thrown by newSubContexts when resourceType is GROUP and the supplied apache.rocketmq.v2.Resource is null or has a blank name: AuthorizationException('group is null.'). Reached from the telemetry SETTINGS path (subscription.group) and group-subscription wrappers; the group name is required to build the group Resource a SUB action is authorized against.","triggerScenarios":"A gRPC SETTINGS command whose subscription section is present but whose group Resource is unset (Subscription.newBuilder().setGroup(Resource.newBuilder().build())) or has an empty name — i.e. the client declared subscriptions without identifying its consumer group. The same helper throws 'topic is null.' for the TOPIC variant on each subscription entry.","commonSituations":"Custom gRPC consumers omitting the group when they only want push/pop without a declared group; config-driven subscription builders where the group property is missing in one environment; clients ported from the remoting protocol that forgot the gRPC group is part of settings.","solutions":["Set a non-blank group name: subscription.setGroup(Resource.newBuilder().setName(consumerGroup)).","Validate consumerGroup config at client startup before establishing the gRPC session.","Use the official client, which requires a group when subscribing."],"exampleFix":"// before\nSubscription sub = Subscription.newBuilder()\n    .addSubscriptions(entry).build(); // group never set\n\n// after\nSubscription sub = Subscription.newBuilder()\n    .setGroup(Resource.newBuilder().setName(consumerGroup))\n    .addSubscriptions(entry).build();","handlingStrategy":"validation","validationCode":"if (consumerGroup == null || consumerGroup.isBlank()) {\n    throw new IllegalArgumentException(\"consumer group required for subscription settings\");\n}\nSubscription sub = Subscription.newBuilder()\n    .setGroup(Resource.newBuilder().setName(consumerGroup)).build();","typeGuard":"static boolean isNamedResource(apache.rocketmq.v2.Resource r) {\n    return r != null && !r.getName().isBlank();\n}","tryCatchPattern":"try { telemetry(settingsCmd); }\ncatch (AuthorizationException e) {\n    if (\"group is null.\".equals(e.getMessage())) { setGroupAndResend(consumerGroup); return; }\n    throw e;\n}","preventionTips":["Require a consumer group whenever subscriptions are declared","Validate group config at startup","Use the official gRPC client which enforces group presence"],"tags":["rocketmq","grpc","telemetry","consumer-group","validation"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}