prestodb/presto · error · PrestoException

INVALID_RESOURCE_GROUP

INVALID_RESOURCE_GROUP

Error message

Cannot add queries to %s. It is not a leaf group.

What it means

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.

Solutions

  1. Submit the query to one of the group's leaf subgroups instead of the parent
  2. Fix the resource group configuration (resource-groups.json or the configuration manager plugin) so the intended group is a leaf
  3. Fix the selector rules so they match a leaf group for this user/source
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java:723 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/da2fd77a0b921851. Report an issue: GitHub.

Appendix: source

Thrown at presto-main-base/src/main/java/com/facebook/presto/execution/resourceGroups/InternalResourceGroup.java:723

        return taskCount;
    }

    protected void setDirty()
    {
        synchronized (root) {
            this.isDirty.set(true);
            dirtySubGroups.addAll(subGroups());
            subGroups().forEach(InternalResourceGroup::setDirty);
        }
    }

    public void run(ManagedQueryExecution query)
    {
        boolean isQueryQueueFull = false;
        synchronized (root) {
            if (!subGroups.isEmpty()) {
                throw new PrestoException(INVALID_RESOURCE_GROUP, format("Cannot add queries to %s. It is not a leaf group.", id));
            }
            // Check all ancestors for capacity
            InternalResourceGroup group = this;
            boolean canQueue = true;
            boolean canRun = true;
            while (true) {
                canQueue &= group.canQueueMore();
                canRun &= group.canRunMore();
                if (!group.parent.isPresent()) {
                    break;
                }
                group = group.parent.get();
            }
            if (!canQueue && !canRun) {
                isQueryQueueFull = true;
            }
            else {
                query.setResourceGroupQueryLimits(perQueryLimits);

View on GitHub (pinned to 55bb57d202)