flowable/flowable-engine · error · FlowableIllegalArgumentException

Value for param 'sort' is not valid, '" + sort + "' is not…

Error message

Value for param 'sort' is not valid, '" + sort + "' is not a valid property

What it means

paginateList maps the REST 'sort' parameter to a QueryProperty via a properties map. If the sort name is not a key in that map, the query cannot be ordered safely, so FlowableIllegalArgumentException is thrown naming the invalid sort value. This protects the query API from arbitrary orderBy columns.

Solutions

  1. Use a sort value from the endpoint's allowed QueryProperty set (check the endpoint's documentation or the properties map passed to paginateList).
  2. Fix client-side typos in the sort parameter name.
  3. If the endpoint is custom, add the desired QueryProperty to the properties map passed into paginateList.
  4. Default to omitting the sort parameter so the endpoint applies its default ordering.

Example fix

// before
GET /flowable-tasks?sort=createdBy
// after
GET /flowable-tasks?sort=createTime
Defensive patterns

Strategy: validation

Validate before calling

Set<String> allowed = properties.keySet();
if (sort != null && !allowed.contains(sort)) {
    sort = allowed.iterator().next(); // or omit sort entirely
}

Type guard

boolean isValidSort(String sort, Map<String, QueryProperty> props) {
    return sort == null || props == null || props.containsKey(sort);
}

Try / catch

try {
    response = listEndpoint(queryParams);
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().contains("param 'sort' is not valid")) {
        queryParams.remove("sort");
        response = listEndpoint(queryParams); // retry with default sort
    } else throw e;
}

Prevention

When it happens

Trigger: Any REST list endpoint using PaginateListUtil.paginateList where the request's sort parameter is not one of the allowed QueryProperty names for that endpoint (e.g. sort=createdBy when only name/start/dueDate are supported).

Common situations: Clients hard-coding sort fields copied from a different endpoint's documentation; frontend sending empty or misspelled sort values; API version changes renaming sortable properties.

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 flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/5885ca4f2b4759c5. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-common-rest/src/main/java/org/flowable/common/rest/api/PaginateListUtil.java:120

        Integer size = paginateRequest.getSize();
        if (size == null || size < 0) {
            size = 10;
        }

        String sort = paginateRequest.getSort();
        if (sort == null) {
            sort = defaultSort;
        }
        String order = paginateRequest.getOrder();
        if (order == null) {
            order = "asc";
        }

        // Sort order
        if (sort != null && properties != null && !properties.isEmpty()) {
            QueryProperty queryProperty = properties.get(sort);
            if (queryProperty == null) {
                throw new FlowableIllegalArgumentException("Value for param 'sort' is not valid, '" + sort + "' is not a valid property");
            }

            query.orderBy(queryProperty);
            if ("asc".equals(order)) {
                query.asc();
            } else if ("desc".equals(order)) {
                query.desc();
            } else {
                throw new FlowableIllegalArgumentException("Value for param 'order' is not valid : '" + order + "', must be 'asc' or 'desc'");
            }
        }

        DataResponse<RES> response = new DataResponse<>();
        response.setStart(start);
        response.setSort(sort);
        response.setOrder(order);

        // Get result and set pagination parameters

View on GitHub (pinned to d6d39ce1c6)