{"record":{"id":"648484d631957998","repo":"prestodb/presto","slug":"invalid-task-count-state-requested","errorCode":null,"errorMessage":"Invalid task count state requested","messagePattern":"Invalid task count state requested","errorType":"http","errorClass":"ResourceManagerException","httpStatus":500,"severity":"error","filePath":"presto-main/src/main/java/com/facebook/presto/server/ResourceManagerResource.java","lineNumber":170,"sourceCode":"    @Consumes(APPLICATION_JSON)\n    @Path(\"/nodes/{nodeId}/resource-groups\")\n    public void putResourceGroupRuntimeInfo(@PathParam(\"nodeId\") String node, List<ResourceGroupRuntimeInfo> resourceGroupRuntimeInfos)\n    {\n        executor.execute(() -> clusterStateProvider.registerResourceGroupRuntimeHeartbeat(node, resourceGroupRuntimeInfos));\n    }\n\n    @GET\n    @Produces(APPLICATION_JSON)\n    @Path(\"/tasks/count\")\n    public void getTaskCount(@QueryParam(\"state\") String state, @Suspended AsyncResponse async)\n    {\n        executor.execute(() -> {\n            try {\n                if (state.equals(\"running\")) {\n                    async.resume(clusterStateProvider.getRunningTaskCount());\n                }\n                else {\n                    throw new ResourceManagerException(\"Invalid task count state requested\");\n                }\n            }\n            catch (Throwable t) {\n                async.resume(Response.serverError()\n                        .entity(ImmutableMap.of(\"error\", t.getMessage()))\n                        .type(APPLICATION_JSON)\n                        .build());\n            }\n        });\n    }\n}\n","sourceCodeStart":152,"sourceCodeEnd":182,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main/src/main/java/com/facebook/presto/server/ResourceManagerResource.java#L152-L182","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nGET /v1/taskCount?state=RUNNING\n// after\nGET /v1/taskCount?state=running","handlingStrategy":"validation","validationCode":"if (!\"running\".equals(state)) { throw new IllegalArgumentException(\"Only state=running is supported, got: \" + state); }","typeGuard":"boolean isSupportedTaskCountState(String s) { return \"running\".equals(s); }","tryCatchPattern":"try { resp = rmClient.getTaskCount(state); } catch (ServerErrorException e) { LOG.warn(\"Bad state param: {}\", state); resp = fallbackTaskCount(); }","preventionTips":["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"],"tags":["rest","invalid-parameter","http-500"],"backgroundTag":"invalid-query-parameter","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"}