{"record":{"id":"821a07ea9220a5f3","repo":"flowable/flowable-engine","slug":"value-for-param-order-is-not-valid-order","errorCode":null,"errorMessage":"Value for param 'order' is not valid : '\" + order + \"', must be 'asc' or 'desc'","messagePattern":"Value for param 'order' is not valid : '\" \\+ order \\+ \"', must be 'asc' or 'desc'","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-common-rest/src/main/java/org/flowable/common/rest/api/PaginateListUtil.java","lineNumber":129,"sourceCode":"        String order = paginateRequest.getOrder();\n        if (order == null) {\n            order = \"asc\";\n        }\n\n        // Sort order\n        if (sort != null && properties != null && !properties.isEmpty()) {\n            QueryProperty queryProperty = properties.get(sort);\n            if (queryProperty == null) {\n                throw new FlowableIllegalArgumentException(\"Value for param 'sort' is not valid, '\" + sort + \"' is not a valid property\");\n            }\n\n            query.orderBy(queryProperty);\n            if (\"asc\".equals(order)) {\n                query.asc();\n            } else if (\"desc\".equals(order)) {\n                query.desc();\n            } else {\n                throw new FlowableIllegalArgumentException(\"Value for param 'order' is not valid : '\" + order + \"', must be 'asc' or 'desc'\");\n            }\n        }\n\n        DataResponse<RES> response = new DataResponse<>();\n        response.setStart(start);\n        response.setSort(sort);\n        response.setOrder(order);\n\n        // Get result and set pagination parameters\n        List<RES> list = listProcessor.processList(query.listPage(start, size));\n        if (start == 0 && list.size() < size) {\n            response.setTotal(list.size());\n        } else {\n            response.setTotal(query.count());\n        }\n\n        response.setSize(list.size());\n        response.setData(list);","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/api/PaginateListUtil.java#L111-L147","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","solutions":["Send exactly 'asc' or 'desc' (lowercase) in the order parameter.","Normalize the client value to lowercase before sending (order.toLowerCase()).","Omit the order parameter entirely and rely on the endpoint's default direction.","If you own the endpoint, pre-validate/normalize order before calling paginateList."],"exampleFix":"// before\nGET /tasks?sort=name&order=ASC\n// after\nGET /tasks?sort=name&order=desc","handlingStrategy":"validation","validationCode":"if (order != null && !\"asc\".equals(order) && !\"desc\".equals(order)) {\n    order = \"asc\"; // or reject the request\n}","typeGuard":"boolean isValidOrder(String order) {\n    return order == null || \"asc\".equals(order) || \"desc\".equals(order);\n}","tryCatchPattern":"try {\n    response = listEndpoint(queryParams);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"param 'order' is not valid\")) {\n        queryParams.put(\"order\", \"asc\");\n        response = listEndpoint(queryParams);\n    } else throw e;\n}","preventionTips":["Normalize the order value to lowercase in the client before sending.","Restrict UI sort controls to emit only 'asc'/'desc'.","Omit the order parameter when relying on defaults.","Document the exact accepted values ('asc'/'desc') in client API wrappers."],"tags":["rest","query-parameters","sorting","validation"],"backgroundTag":"invalid-query-parameter","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}