flowable/flowable-engine · error · FlowableIllegalArgumentException

categoryNotEquals is null

Error message

categoryNotEquals is null

What it means

ModelQueryImpl.modelCategoryNotEquals filters out models whose category equals the given value. A null argument throws FlowableIllegalArgumentException because 'not equals null' is not a meaningful filter in the underlying query; do not call the method when the exclusion value is absent.

Solutions

  1. Only invoke modelCategoryNotEquals when the value is non-null (conditional query building)
  2. Provide a concrete category string to exclude
  3. Validate configuration/request input before building the query
  4. If the intent is 'any category except none', use modelCategory(...) with a positive filter instead

Example fix

// before
ModelQuery q = repositoryService.createModelQuery()
    .modelCategoryNotEquals(opts.getExcludedCategory()); // may be null
// after
ModelQuery q = repositoryService.createModelQuery();
if (opts.getExcludedCategory() != null) {
    q = q.modelCategoryNotEquals(opts.getExcludedCategory());
}
Defensive patterns

Strategy: validation

Validate before calling

if (categoryNotEquals != null) { query = query.modelCategoryNotEquals(categoryNotEquals); }

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Calling repositoryService.createModelQuery().modelCategoryNotEquals(excludedCategory) with a null value, typically from an optional exclusion filter in UI or API input.

Common situations: Admin dashboards letting users exclude a category via a dropdown that defaults to null; batch jobs with optional exclusion config entries left blank.

Related errors


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

Appendix: source

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

            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");
        }
        this.name = name;
        return this;
    }

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

View on GitHub (pinned to d6d39ce1c6)