{"record":{"id":"8fb691dce71a716e","repo":"prestodb/presto","slug":"parameter-limit-for-getallqueryinfo-must-be-posi-8fb691","errorCode":null,"errorMessage":"Parameter 'limit' for getAllQueryInfo must be positive. Got %d.","messagePattern":"Parameter 'limit' for getAllQueryInfo must be positive\\. Got (.+?)\\.","errorType":"http","errorClass":"WebApplicationException","httpStatus":400,"severity":"error","filePath":"presto-main/src/main/java/com/facebook/presto/server/QueryResource.java","lineNumber":141,"sourceCode":"    }\n\n    @GET\n    public void getAllQueryInfo(\n            @QueryParam(\"state\") String stateFilter,\n            @QueryParam(\"limit\") Integer limitFilter,\n            @HeaderParam(X_FORWARDED_PROTO) String xForwardedProto,\n            @Context UriInfo uriInfo,\n            @Context HttpServletRequest servletRequest,\n            @Suspended AsyncResponse asyncResponse)\n    {\n        if (resourceManagerEnabled) {\n            proxyResponse(servletRequest, asyncResponse, xForwardedProto, uriInfo);\n            return;\n        }\n\n        int limit = firstNonNull(limitFilter, Integer.MAX_VALUE);\n        if (limit <= 0) {\n            throw new WebApplicationException(Response\n                    .status(BAD_REQUEST)\n                    .type(MediaType.TEXT_PLAIN)\n                    .entity(format(\"Parameter 'limit' for getAllQueryInfo must be positive. Got %d.\", limit))\n                    .build());\n        }\n\n        List<BasicQueryInfo> queries = new ArrayList<>(dispatchManager.getQueries());\n\n        // Filter list by the query state (if specified).\n        if (stateFilter != null) {\n            QueryState expectedState = QueryState.valueOf(stateFilter.toUpperCase(Locale.ENGLISH));\n            queries.removeIf(item -> item.getState() != expectedState);\n        }\n\n        // If limit is smaller than number of queries, then ensure that the more recent items are at the front.\n        if (limit < queries.size()) {\n            queries.sort(QUERIES_ORDERING);\n        }","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-main/src/main/java/com/facebook/presto/server/QueryResource.java#L123-L159","documentation":"Request-parameter validation in the queries REST endpoint: the 'limit' query parameter of GET /v1/query (getAllQueryInfo) was supplied as zero or negative. Limits must be positive because they bound the number of returned query states; the actual value is formatted into the message.","triggerScenarios":"Thrown at presto-main/src/main/java/com/facebook/presto/server/QueryResource.java:141 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send a positive integer limit, or omit the parameter"],"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"}