flowable/flowable-engine · error · FlowableIllegalArgumentException

categoryLike is null

Error message

categoryLike is null

What it means

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.

Solutions

  1. Guard the call: only add modelCategoryLike when the pattern is non-null
  2. Escape and validate the pattern (e.g. ensure wildcards are intended) before passing it
  3. Default the pattern to a non-null wildcard like "%" only if you truly want all categories (prefer no filter instead)
  4. Validate the incoming request parameter before query construction

Example fix

// before
ModelQuery q = repositoryService.createModelQuery()
    .modelCategoryLike(form.getCategoryLike()); // may be null
// after
ModelQuery q = repositoryService.createModelQuery();
String like = form.getCategoryLike();
if (like != null && !like.isEmpty()) {
    q = q.modelCategoryLike("%" + like + "%");
}
Defensive patterns

Strategy: validation

Validate before calling

if (categoryLike != null) { query = query.modelCategoryLike(categoryLike); }

Type guard

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

Try / catch

try {
    List<Model> models = query.modelCategoryLike(categoryLike).list();
} catch (FlowableIllegalArgumentException e) {
    log.warn("Bad LIKE filter: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Calling repositoryService.createModelQuery().modelCategoryLike(categoryLike) with a null pattern, e.g. an empty search form submitted without a category substring.

Common situations: 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.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/ModelQueryImpl.java:78

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

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

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

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

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

View on GitHub (pinned to d6d39ce1c6)