{"record":{"id":"5caa761a26bc3e7f","repo":"flowable/flowable-engine","slug":"category-is-null-5caa76","errorCode":null,"errorMessage":"category is null","messagePattern":"category is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ModelQueryImpl.java","lineNumber":67,"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 ActivitiIllegalArgumentException(\"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 ActivitiIllegalArgumentException(\"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 ActivitiIllegalArgumentException(\"categoryNotEquals is null\");","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ModelQueryImpl.java#L49-L85","documentation":"ModelQueryImpl.modelCategory(String) sets an exact-match filter on the model category and rejects null because a null category filter is ambiguous (no filter) — the API expects callers to simply not call the method when no filter is wanted. Null input throws ActivitiIllegalArgumentException.","triggerScenarios":"repositoryService.createModelQuery().modelCategory(someVariable) where someVariable is null, usually a request parameter or DB column value that was not populated.","commonSituations":"REST query parameter omitted by the client and passed straight through; model deployed without a category while UI code still applies the filter; configuration value missing.","solutions":["Only call modelCategory when the value is non-null/non-empty","If 'no category' models are wanted, use modelCategoryNotEquals or skip the filter","Validate/sanitize the incoming request parameter before applying it to the query"],"exampleFix":"// before\nquery.modelCategory(request.getCategory()); // may be null\n// after\nModelQuery q = query;\nif (request.getCategory() != null) { q = q.modelCategory(request.getCategory()); }","handlingStrategy":"validation","validationCode":"if (category != null && !category.isEmpty()) { query.modelCategory(category); }","typeGuard":"boolean hasText(String s) { return s != null && !s.trim().isEmpty(); }","tryCatchPattern":"try {\n    query.modelCategory(category);\n} catch (ActivitiIllegalArgumentException e) {\n    // fall back to unfiltered query\n}","preventionTips":["Apply query filters conditionally, only when the parameter is present","Normalize missing request params to null and skip the filter call","Document that *Query filter methods reject null"],"tags":["java","flowable","model-query","null-check","query-filter"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T16:17:23.245Z"}