prestodb/presto · error · WebApplicationException

Parameter 'limit' for getAllQueryInfo must be positive. Got

Error message

Parameter 'limit' for getAllQueryInfo must be positive. Got %d.

What it means

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.

Source

Thrown at presto-main/src/main/java/com/facebook/presto/server/QueryResource.java:141

    }

    @GET
    public void getAllQueryInfo(
            @QueryParam("state") String stateFilter,
            @QueryParam("limit") Integer limitFilter,
            @HeaderParam(X_FORWARDED_PROTO) String xForwardedProto,
            @Context UriInfo uriInfo,
            @Context HttpServletRequest servletRequest,
            @Suspended AsyncResponse asyncResponse)
    {
        if (resourceManagerEnabled) {
            proxyResponse(servletRequest, asyncResponse, xForwardedProto, uriInfo);
            return;
        }

        int limit = firstNonNull(limitFilter, Integer.MAX_VALUE);
        if (limit <= 0) {
            throw new WebApplicationException(Response
                    .status(BAD_REQUEST)
                    .type(MediaType.TEXT_PLAIN)
                    .entity(format("Parameter 'limit' for getAllQueryInfo must be positive. Got %d.", limit))
                    .build());
        }

        List<BasicQueryInfo> queries = new ArrayList<>(dispatchManager.getQueries());

        // Filter list by the query state (if specified).
        if (stateFilter != null) {
            QueryState expectedState = QueryState.valueOf(stateFilter.toUpperCase(Locale.ENGLISH));
            queries.removeIf(item -> item.getState() != expectedState);
        }

        // If limit is smaller than number of queries, then ensure that the more recent items are at the front.
        if (limit < queries.size()) {
            queries.sort(QUERIES_ORDERING);
        }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Send a positive integer limit, or omit the parameter
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-main/src/main/java/com/facebook/presto/server/QueryResource.java:141 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/8fb691dce71a716e. Report an issue: GitHub.