flowable/flowable-engine · error · FlowableIllegalArgumentException
Cannot combine onlyCmmn() with onlyBpmn() in the same query
Error message
Cannot combine onlyCmmn() with onlyBpmn() in the same query
What it means
ExternalWorkerJobAcquireBuilderImpl.onlyBpmn() restricts acquisition to BPMN jobs. If scopeType is already CMMN (e.g. onlyCmmn() was called first), combining the two is ambiguous, so Flowable throws FlowableIllegalArgumentException.
Solutions
- Use only one scope restriction per builder
- Reset/recreate the builder when switching scope
- Use scopeType(String) once with a variable value instead of chaining fixed calls
Example fix
// before builder.onlyCmmn().onlyBpmn(); // after builder.onlyBpmn();
Defensive patterns
Strategy: validation
Validate before calling
if (useBpmn && useCmmn) throw new IllegalArgumentException("onlyBpmn and onlyCmmn are mutually exclusive"); Try / catch
try { builder.onlyBpmn(); } catch (FlowableIllegalArgumentException e) { if (!e.getMessage().contains("Cannot combine")) throw e; /* resolve conflicting scope flags */ } Prevention
- Model scope choice as an enum instead of independent booleans
- Use if/else, not sequential builder calls, for scope selection
- Test builder chains with both flags set
When it happens
Trigger: Calling onlyCmmn() then onlyBpmn() (in either order) on the same acquire builder.
Common situations: Accidentally chaining both scope restrictions when building a flexible acquisition request; copy-paste of builder calls.
Related errors
- Cannot combine onlyBpmn() with onlyCmmn() in the same query
- Cannot combine scopeType(String) with onlyBpmn() in the…
- Cannot combine scopeType(String) with onlyCmmn() in the…
- at least one of userId or groups must be provided
- Cannot use subScopeId together with excludeLocalVariables
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/8eced4572ac662d7.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/ExternalWorkerJobAcquireBuilderImpl.java:67
@Override
public ExternalWorkerJobAcquireBuilder topic(String topic, Duration lockDuration) {
if (topic == null) {
throw new FlowableIllegalArgumentException("topic is null");
}
if (lockDuration == null) {
throw new FlowableIllegalArgumentException("lockDuration is null");
}
this.topic = topic;
this.lockDuration = lockDuration;
return this;
}
@Override
public ExternalWorkerJobAcquireBuilder onlyBpmn() {
if (ScopeTypes.CMMN.equals(scopeType)) {
throw new FlowableIllegalArgumentException("Cannot combine onlyCmmn() with onlyBpmn() in the same query");
}
if (scopeType != null) {
throw new FlowableIllegalArgumentException("Cannot combine scopeType(String) with onlyBpmn() in the same query");
}
return scopeType(ScopeTypes.BPMN);
}
@Override
public ExternalWorkerJobAcquireBuilder onlyCmmn() {
if (ScopeTypes.BPMN.equals(scopeType)) {
throw new FlowableIllegalArgumentException("Cannot combine onlyBpmn() with onlyCmmn() in the same query");
}
if (scopeType != null) {
throw new FlowableIllegalArgumentException("Cannot combine scopeType(String) with onlyCmmn() in the same query");
}
return scopeType(ScopeTypes.CMMN);View on GitHub (pinned to d6d39ce1c6)