prestodb/presto · error · ResourceManagerException
Invalid task count state requested
Error message
Invalid task count state requested
What it means
ResourceManagerResource.getTaskCount rejects the 'state' query parameter because it does not name a recognized task state for the /tasks/count endpoint; an input validation guard inside the async handler.
Source
Thrown at presto-main/src/main/java/com/facebook/presto/server/ResourceManagerResource.java:170
@Consumes(APPLICATION_JSON)
@Path("/nodes/{nodeId}/resource-groups")
public void putResourceGroupRuntimeInfo(@PathParam("nodeId") String node, List<ResourceGroupRuntimeInfo> resourceGroupRuntimeInfos)
{
executor.execute(() -> clusterStateProvider.registerResourceGroupRuntimeHeartbeat(node, resourceGroupRuntimeInfos));
}
@GET
@Produces(APPLICATION_JSON)
@Path("/tasks/count")
public void getTaskCount(@QueryParam("state") String state, @Suspended AsyncResponse async)
{
executor.execute(() -> {
try {
if (state.equals("running")) {
async.resume(clusterStateProvider.getRunningTaskCount());
}
else {
throw new ResourceManagerException("Invalid task count state requested");
}
}
catch (Throwable t) {
async.resume(Response.serverError()
.entity(ImmutableMap.of("error", t.getMessage()))
.type(APPLICATION_JSON)
.build());
}
});
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Pass state=running (lowercase) exactly
- Remove the state parameter only if the API allows a default
- Check the ResourceManagerResource source for newly supported states and upgrade if your build lacks them
Example fix
// before GET /v1/taskCount?state=RUNNING // after GET /v1/taskCount?state=running
Defensive patterns
Strategy: validation
Validate before calling
if (!"running".equals(state)) { throw new IllegalArgumentException("Only state=running is supported, got: " + state); } Type guard
boolean isSupportedTaskCountState(String s) { return "running".equals(s); } Try / catch
try { resp = rmClient.getTaskCount(state); } catch (ServerErrorException e) { LOG.warn("Bad state param: {}", state); resp = fallbackTaskCount(); } Prevention
- Always pass state=running in lowercase
- Keep a constant TASK_COUNT_STATE_RUNNING = "running" instead of inline strings
- Re-check the endpoint docs when upgrading Presto versions
When it happens
Trigger: GET to the task count endpoint on the resource manager with ?state=<anything other than the literal 'running'>, e.g. state=queued or state=RUNNING (case-sensitive).
Common situations: Clients guessing supported state names, capitalization mistakes ('RUNNING' vs 'running'), documentation gaps leading users to try 'completed' or 'queued', or scripted monitoring tools passing wrong params.
Understand the failure class
Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/648484d631957998.
Report an issue: GitHub.