{"record":{"id":"5885ca4f2b4759c5","repo":"flowable/flowable-engine","slug":"value-for-param-sort-is-not-valid-sort","errorCode":null,"errorMessage":"Value for param 'sort' is not valid, '\" + sort + \"' is not a valid property","messagePattern":"Value for param 'sort' is not valid, '\" \\+ sort \\+ \"' is not a valid property","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-common-rest/src/main/java/org/flowable/common/rest/api/PaginateListUtil.java","lineNumber":120,"sourceCode":"        Integer size = paginateRequest.getSize();\n        if (size == null || size < 0) {\n            size = 10;\n        }\n\n        String sort = paginateRequest.getSort();\n        if (sort == null) {\n            sort = defaultSort;\n        }\n        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","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-common-rest/src/main/java/org/flowable/common/rest/api/PaginateListUtil.java#L102-L138","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Use a sort value from the endpoint's allowed QueryProperty set (check the endpoint's documentation or the properties map passed to paginateList).","Fix client-side typos in the sort parameter name.","If the endpoint is custom, add the desired QueryProperty to the properties map passed into paginateList.","Default to omitting the sort parameter so the endpoint applies its default ordering."],"exampleFix":"// before\nGET /flowable-tasks?sort=createdBy\n// after\nGET /flowable-tasks?sort=createTime","handlingStrategy":"validation","validationCode":"Set<String> allowed = properties.keySet();\nif (sort != null && !allowed.contains(sort)) {\n    sort = allowed.iterator().next(); // or omit sort entirely\n}","typeGuard":"boolean isValidSort(String sort, Map<String, QueryProperty> props) {\n    return sort == null || props == null || props.containsKey(sort);\n}","tryCatchPattern":"try {\n    response = listEndpoint(queryParams);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"param 'sort' is not valid\")) {\n        queryParams.remove(\"sort\");\n        response = listEndpoint(queryParams); // retry with default sort\n    } else throw e;\n}","preventionTips":["Consult the endpoint's documented sortable properties before setting sort.","Centralize allowed sort names in the client and validate against them.","Send no sort parameter when default ordering is acceptable.","Watch for sort-name changes between Flowable REST API versions."],"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"}