{"record":{"id":"3571ae9ef658a609","repo":"flowable/flowable-engine","slug":"category-is-null-3571ae","errorCode":null,"errorMessage":"category is null","messagePattern":"category is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/ModelQueryImpl.java","lineNumber":69,"sourceCode":"\n    public ModelQueryImpl(CommandContext commandContext) {\n        super(commandContext);\n    }\n\n    public ModelQueryImpl(CommandExecutor commandExecutor) {\n        super(commandExecutor);\n    }\n\n    @Override\n    public ModelQueryImpl modelId(String modelId) {\n        this.id = modelId;\n        return this;\n    }\n\n    @Override\n    public ModelQueryImpl modelCategory(String category) {\n        if (category == null) {\n            throw new FlowableIllegalArgumentException(\"category is null\");\n        }\n        this.category = category;\n        return this;\n    }\n\n    @Override\n    public ModelQueryImpl modelCategoryLike(String categoryLike) {\n        if (categoryLike == null) {\n            throw new FlowableIllegalArgumentException(\"categoryLike is null\");\n        }\n        this.categoryLike = categoryLike;\n        return this;\n    }\n\n    @Override\n    public ModelQueryImpl modelCategoryNotEquals(String categoryNotEquals) {\n        if (categoryNotEquals == null) {\n            throw new FlowableIllegalArgumentException(\"categoryNotEquals is null\");","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/ModelQueryImpl.java#L51-L87","documentation":"ModelQueryImpl.modelCategory sets an exact-match filter on the model's category. A null filter is rejected with FlowableIllegalArgumentException because a null would be indistinguishable from 'no filter applied'; the API requires callers to simply not call modelCategory when they do not want to filter by category.","triggerScenarios":"Calling repositoryService.createModelQuery().modelCategory(category) with a null category, usually when the category comes from a request parameter, database field, or variable that is null.","commonSituations":"REST endpoints forwarding user-supplied category filters straight into the query; UIs with optional category fields; deserialization producing null for absent JSON fields.","solutions":["Only call modelCategory when the value is non-null: build the query conditionally","Replace null with an explicit sentinel you intend to match (models without category need a different API)","Validate/normalize request input before constructing the query","Use modelCategoryLike with a non-null pattern only if a partial match is actually wanted"],"exampleFix":"// before\nModelQuery query = repositoryService.createModelQuery()\n    .modelCategory(request.getCategory()); // may be null\n// after\nModelQuery query = repositoryService.createModelQuery();\nif (request.getCategory() != null) {\n    query = query.modelCategory(request.getCategory());\n}","handlingStrategy":"validation","validationCode":"if (category != null) { query = query.modelCategory(category); }","typeGuard":"boolean hasText(String s) { return s != null && !s.trim().isEmpty(); }","tryCatchPattern":"try {\n    List<Model> models = query.modelCategory(category).list();\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Bad model query filter: {}\", e.getMessage());\n}","preventionTips":["Build Flowable queries conditionally: only add filters for present values","Treat optional request fields as 'no filter' rather than passing them raw","Normalize input (trim/empty-to-null) before query building"],"tags":["java","flowable","query","null-argument"],"backgroundTag":"null-argument","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"}