{"record":{"id":"da2fd77a0b921851","repo":"prestodb/presto","slug":"invalid-resource-group","errorCode":"INVALID_RESOURCE_GROUP","errorMessage":"Cannot add queries to %s. It is not a leaf group.","messagePattern":"Cannot add queries to (.+?)\\. It is not a leaf group\\.","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-main-base/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java","lineNumber":723,"sourceCode":"\n        return taskCount;\n    }\n\n    protected void setDirty()\n    {\n        synchronized (root) {\n            this.isDirty.set(true);\n            dirtySubGroups.addAll(subGroups());\n            subGroups().forEach(InternalResourceGroup::setDirty);\n        }\n    }\n\n    public void run(ManagedQueryExecution query)\n    {\n        boolean isQueryQueueFull = false;\n        synchronized (root) {\n            if (!subGroups.isEmpty()) {\n                throw new PrestoException(INVALID_RESOURCE_GROUP, format(\"Cannot add queries to %s. It is not a leaf group.\", id));\n            }\n            // Check all ancestors for capacity\n            InternalResourceGroup group = this;\n            boolean canQueue = true;\n            boolean canRun = true;\n            while (true) {\n                canQueue &= group.canQueueMore();\n                canRun &= group.canRunMore();\n                if (!group.parent.isPresent()) {\n                    break;\n                }\n                group = group.parent.get();\n            }\n            if (!canQueue && !canRun) {\n                isQueryQueueFull = true;\n            }\n            else {\n                query.setResourceGroupQueryLimits(perQueryLimits);","sourceCodeStart":705,"sourceCodeEnd":741,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main-base/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java#L705-L741","documentation":"PrestoException (INVALID_RESOURCE_GROUP) from InternalResourceGroup.run: a query was submitted to a resource group that has subgroups, making it a scheduling container rather than a leaf. Only leaf groups can run queries; parents exist purely to organize and limit children.","triggerScenarios":"Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java:723 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Submit the query to one of the group's leaf subgroups instead of the parent","Fix the resource group configuration (resource-groups.json or the configuration manager plugin) so the intended group is a leaf","Fix the selector rules so they match a leaf group for this user/source"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}