flowable/flowable-engine · error · FlowableIllegalArgumentException

Value for param 'order' is not valid : '" + order + "'…

Error message

Value for param 'order' is not valid : '" + order + "', must be 'asc' or 'desc'

What it means

When a sort property is applied, the 'order' REST parameter must be exactly 'asc' or 'desc'. Any other value makes the sort direction ambiguous, so paginateList throws FlowableIllegalArgumentException with the offending value. This keeps ordering deterministic on list endpoints.

Solutions

  1. Send exactly 'asc' or 'desc' (lowercase) in the order parameter.
  2. Normalize the client value to lowercase before sending (order.toLowerCase()).
  3. Omit the order parameter entirely and rely on the endpoint's default direction.
  4. If you own the endpoint, pre-validate/normalize order before calling paginateList.

Example fix

// before
GET /tasks?sort=name&order=ASC
// after
GET /tasks?sort=name&order=desc
Defensive patterns

Strategy: validation

Validate before calling

if (order != null && !"asc".equals(order) && !"desc".equals(order)) {
    order = "asc"; // or reject the request
}

Type guard

boolean isValidOrder(String order) {
    return order == null || "asc".equals(order) || "desc".equals(order);
}

Try / catch

try {
    response = listEndpoint(queryParams);
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().contains("param 'order' is not valid")) {
        queryParams.put("order", "asc");
        response = listEndpoint(queryParams);
    } else throw e;
}

Prevention

When it happens

Trigger: Calling any paginated REST list endpoint with order=ascending, order=ASC, order=DESC (uppercase), or any value other than the exact lowercase strings 'asc'/'desc'.

Common situations: Frontend sending 'ascending'/'descending' instead of 'asc'/'desc'; case-sensitivity issues after clients switched to uppercase query params; template code passing an empty or default string for order.

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/821a07ea9220a5f3. Report an issue: GitHub.

Appendix: source

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

        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
        List<RES> list = listProcessor.processList(query.listPage(start, size));
        if (start == 0 && list.size() < size) {
            response.setTotal(list.size());
        } else {
            response.setTotal(query.count());
        }

        response.setSize(list.size());
        response.setData(list);

View on GitHub (pinned to d6d39ce1c6)