{"record":{"id":"89019c966e2740eb","repo":"flowable/flowable-engine","slug":"categorylike-is-null-89019c","errorCode":null,"errorMessage":"categoryLike is null","messagePattern":"categoryLike is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/ModelQueryImpl.java","lineNumber":78,"sourceCode":"    @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\");\n        }\n        this.categoryNotEquals = categoryNotEquals;\n        return this;\n    }\n\n    @Override\n    public ModelQueryImpl modelName(String name) {\n        if (name == null) {\n            throw new FlowableIllegalArgumentException(\"name is null\");","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/ModelQueryImpl.java#L60-L96","documentation":"ModelQueryImpl.modelCategoryLike applies a SQL-style LIKE filter on model category, where '%' is the wildcard. Passing null throws FlowableIllegalArgumentException because a null pattern is invalid for a LIKE filter; omit the call entirely when no category filter is desired.","triggerScenarios":"Calling repositoryService.createModelQuery().modelCategoryLike(categoryLike) with a null pattern, e.g. an empty search form submitted without a category substring.","commonSituations":"Search screens forwarding the raw text field value into the query; backend code that builds the LIKE pattern with String concatenation from optional input; upgrading code that previously ignored null filters.","solutions":["Guard the call: only add modelCategoryLike when the pattern is non-null","Escape and validate the pattern (e.g. ensure wildcards are intended) before passing it","Default the pattern to a non-null wildcard like \"%\" only if you truly want all categories (prefer no filter instead)","Validate the incoming request parameter before query construction"],"exampleFix":"// before\nModelQuery q = repositoryService.createModelQuery()\n    .modelCategoryLike(form.getCategoryLike()); // may be null\n// after\nModelQuery q = repositoryService.createModelQuery();\nString like = form.getCategoryLike();\nif (like != null && !like.isEmpty()) {\n    q = q.modelCategoryLike(\"%\" + like + \"%\");\n}","handlingStrategy":"validation","validationCode":"if (categoryLike != null) { query = query.modelCategoryLike(categoryLike); }","typeGuard":"boolean hasText(String s) { return s != null && !s.trim().isEmpty(); }","tryCatchPattern":"try {\n    List<Model> models = query.modelCategoryLike(categoryLike).list();\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Bad LIKE filter: {}\", e.getMessage());\n}","preventionTips":["Guard LIKE filters with null/empty checks","Validate and escape wildcard characters in user-supplied patterns","Use a query-builder helper that skips null filters centrally"],"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"}