flowable/flowable-engine · error · ActivitiIllegalArgumentException

category is null

Error message

category is null

What it means

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.

Solutions

  1. Only call modelCategory when the value is non-null/non-empty
  2. If 'no category' models are wanted, use modelCategoryNotEquals or skip the filter
  3. Validate/sanitize the incoming request parameter before applying it to the query

Example fix

// before
query.modelCategory(request.getCategory()); // may be null
// after
ModelQuery q = query;
if (request.getCategory() != null) { q = q.modelCategory(request.getCategory()); }
Defensive patterns

Strategy: validation

Validate before calling

if (category != null && !category.isEmpty()) { query.modelCategory(category); }

Type guard

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

Try / catch

try {
    query.modelCategory(category);
} catch (ActivitiIllegalArgumentException e) {
    // fall back to unfiltered query
}

Prevention

When it happens

Trigger: repositoryService.createModelQuery().modelCategory(someVariable) where someVariable is null, usually a request parameter or DB column value that was not populated.

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

Related errors


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

Appendix: source

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

    public ModelQueryImpl(CommandContext commandContext) {
        super(commandContext);
    }

    public ModelQueryImpl(CommandExecutor commandExecutor) {
        super(commandExecutor);
    }

    @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");

View on GitHub (pinned to d6d39ce1c6)