flowable/flowable-engine · error · ActivitiIllegalArgumentException

categoryLike is null

Error message

categoryLike is null

What it means

ModelQueryImpl.modelCategoryLike(String) applies a LIKE-style filter on model category and requires a non-null pattern. Null cannot form a valid LIKE predicate, so ActivitiIllegalArgumentException is thrown.

Solutions

  1. Check the pattern for null (and probably blank) before calling modelCategoryLike
  2. Skip the filter entirely when the search term is absent
  3. Coalesce to a default pattern if a filter is always required

Example fix

// before
query.modelCategoryLike(searchTerm);
// after
if (searchTerm != null && !searchTerm.isEmpty()) {
    query.modelCategoryLike("%" + searchTerm + "%");
}
Defensive patterns

Strategy: validation

Validate before calling

if (categoryLike != null && !categoryLike.trim().isEmpty()) { query.modelCategoryLike("%" + categoryLike.trim() + "%"); }

Type guard

boolean hasText(String s) { return s != null && !s.trim().isEmpty(); }

Try / catch

try {
    query.modelCategoryLike(pattern);
} catch (ActivitiIllegalArgumentException e) {
    // execute query without the like filter
}

Prevention

When it happens

Trigger: repositoryService.createModelQuery().modelCategoryLike(pattern) with a null pattern, e.g. a search box value or config value that was never set.

Common situations: Client sends empty/absent search term mapped to null; dynamic query builder adds the like-filter unconditionally; a '%' wildcard variable not initialized.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/f6a446ad67e6497c. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ModelQueryImpl.java:76

    @Override
    public ModelQueryImpl modelId(String modelId) {
        this.id = modelId;
        return this;
    }

    @Override
    public ModelQueryImpl modelCategory(String category) {
        if (category == null) {
            throw new ActivitiIllegalArgumentException("category is null");
        }
        this.category = category;
        return this;
    }

    @Override
    public ModelQueryImpl modelCategoryLike(String categoryLike) {
        if (categoryLike == null) {
            throw new ActivitiIllegalArgumentException("categoryLike is null");
        }
        this.categoryLike = categoryLike;
        return this;
    }

    @Override
    public ModelQueryImpl modelCategoryNotEquals(String categoryNotEquals) {
        if (categoryNotEquals == null) {
            throw new ActivitiIllegalArgumentException("categoryNotEquals is null");
        }
        this.categoryNotEquals = categoryNotEquals;
        return this;
    }

    @Override
    public ModelQueryImpl modelName(String name) {
        if (name == null) {
            throw new ActivitiIllegalArgumentException("name is null");

View on GitHub (pinned to d6d39ce1c6)