prestodb/presto · error · IllegalArgumentException

Selector specifies an invalid query type: %s

Error message

Selector specifies an invalid query type: %s

What it means

Thrown by validateQueryType when a selector in the resource group configuration declares a queryType value that does not match any QueryType enum constant (compared case-insensitively). The manager wraps QueryType.valueOf's IllegalArgumentException with a clearer message pointing at the bad selector value.

Source

Thrown at presto-resource-group-managers/src/main/java/com/facebook/presto/resourceGroups/AbstractResourceConfigurationManager.java:136

                    .stream()
                    .filter(groupSpec -> groupSpec.getName().equals(groupName))
                    .findFirst();
            if (!match.isPresent()) {
                throw new IllegalArgumentException(format("Selector refers to nonexistent group: %s", fullyQualifiedGroupName.toString()));
            }
            fullyQualifiedGroupName.append(".");
            groups = match.get().getSubGroups();
            selectorGroups = selectorGroups.subList(1, selectorGroups.size());
        }
    }

    private void validateQueryType(String queryType)
    {
        try {
            QueryType.valueOf(queryType.toUpperCase());
        }
        catch (IllegalArgumentException e) {
            throw new IllegalArgumentException(format("Selector specifies an invalid query type: %s", queryType));
        }
    }

    protected AbstractResourceConfigurationManager(ClusterMemoryPoolManager memoryPoolManager)
    {
        memoryPoolManager.addChangeListener(new MemoryPoolId("general"), poolInfo -> {
            Map<ResourceGroup, DataSize> memoryLimits = new HashMap<>();
            synchronized (generalPoolMemoryFraction) {
                for (Map.Entry<ResourceGroup, Double> entry : generalPoolMemoryFraction.entrySet()) {
                    double bytes = poolInfo.getMaxBytes() * entry.getValue();
                    // setSoftMemoryLimit() acquires a lock on the root group of its tree, which could cause a deadlock if done while holding the "generalPoolMemoryFraction" lock
                    memoryLimits.put(entry.getKey(), new DataSize(bytes, BYTE));
                }
                generalPoolBytes = poolInfo.getMaxBytes();
            }
            for (Map.Entry<ResourceGroup, DataSize> entry : memoryLimits.entrySet()) {
                entry.getKey().setSoftMemoryLimit(entry.getValue());
            }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Set queryType to a valid QueryType enum constant (e.g. SELECT, INSERT, DATA_DEFINITION) — case is normalized, spelling must match
  2. Check the configured value against the QueryType enum for your Presto version
  3. Remove the queryType property from the selector if filtering by query type is not needed

Example fix

// before (resource-groups.json)
{"queryType": "SELECRT", ...}
// after
{"queryType": "SELECT", ...}
Defensive patterns

Strategy: validation

Validate before calling

Set<String> valid = Arrays.stream(QueryType.values()).map(Enum::name).collect(Collectors.toSet());
if (queryType == null || !valid.contains(queryType.toUpperCase(Locale.ROOT))) {
    throw new IllegalArgumentException("Invalid queryType in selector: " + queryType);
}

Try / catch

try { QueryType.valueOf(queryType.toUpperCase()); } catch (IllegalArgumentException e) { /* reject config entry, log the bad selector */ }

Prevention

When it happens

Trigger: A ResourceGroupSelector spec in JSON/config contains queryType set to a string that is not a valid QueryType constant (e.g. 'QUERY', 'SLECT', 'select-all'); validateQueryType is called while matching selectors via getMatchingSpec.

Common situations: Typo in the query_type property of a selector in resource group config JSON; using lowercase variants of removed enum names; upgrading Presto where QueryType constants changed.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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