flowable/flowable-engine · error · ActivitiIllegalArgumentException
Cannot combine onlyTimers() with onlyMessages() in the same…
Error message
Cannot combine onlyTimers() with onlyMessages() in the same query
What it means
JobQueryImpl.timers() restricts the query to timer jobs, but onlyMessages() (reached via messages()) restricts it to message jobs; the two are mutually exclusive. The engine throws ActivitiIllegalArgumentException immediately when timers() is called after messages() was already set, because the resulting SQL filter would match no job type consistently.
Solutions
- Remove one of the two calls; pick onlyTimers() or onlyMessages() depending on which job type you need
- If the user wants both job types, drop both filters and query all jobs (or issue two separate queries)
- Validate input options before building the query and reject conflicting combinations early
Example fix
// before
JobQuery query = managementService.createJobQuery().timers().messages();
// after
JobQuery query = managementService.createJobQuery();
if (onlyTimers) {
query = query.timers();
} else if (onlyMessages) {
query = query.messages();
} Defensive patterns
Strategy: validation
Validate before calling
if (onlyTimers && onlyMessages) throw new IllegalArgumentException("Cannot filter for both timer and message jobs in one query"); Try / catch
try {
query = query.timers();
} catch (ActivitiIllegalArgumentException e) {
if (!e.getMessage().contains("onlyTimers")) throw e;
// handle conflicting filter combination, e.g. split into two queries
} Prevention
- Model job-type filters as an enum (ALL, TIMER, MESSAGE) instead of two booleans
- Enforce exclusivity in UI/search forms before the query is built
- Track which filters have been applied when composing queries dynamically
When it happens
Trigger: Calling managementService.createJobQuery().messages().timers() (or with the calls in either order) before executing the query.
Common situations: Dynamically composing query filters from user-supplied options where both 'timer' and 'message' booleans are true; copying query-building code that adds both filters 'for completeness'; UI search forms allowing both checkboxes to be checked.
Related errors
- callbackIds is null or empty
- categoryLike is null
- categoryNotEquals is null
- Could not find a deployment with id
- Could not find an app definition with id
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/66163b7e367c62d4.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable5-engine/src/main/java/org/activiti/engine/impl/JobQueryImpl.java:126
return this;
}
@Override
public JobQuery withRetriesLeft() {
retriesLeft = true;
return this;
}
@Override
public JobQuery executable() {
executable = true;
return this;
}
@Override
public JobQuery timers() {
if (onlyMessages) {
throw new ActivitiIllegalArgumentException("Cannot combine onlyTimers() with onlyMessages() in the same query");
}
this.onlyTimers = true;
return this;
}
@Override
public JobQuery messages() {
if (onlyTimers) {
throw new ActivitiIllegalArgumentException("Cannot combine onlyTimers() with onlyMessages() in the same query");
}
this.onlyMessages = true;
return this;
}
@Override
public JobQuery duedateHigherThan(Date date) {
if (date == null) {
throw new ActivitiIllegalArgumentException("Provided date is null");View on GitHub (pinned to d6d39ce1c6)