flowable/flowable-engine · error · FlowableIllegalArgumentException
Cannot combine onlyInbound() with onlyOutbound() in the same
Error message
Cannot combine onlyInbound() with onlyOutbound() in the same query
What it means
ChannelDefinitionQueryImpl.onlyInbound() throws FlowableIllegalArgumentException if onlyOutbound() was already called on the same query. Inbound and outbound channel type filters are mutually exclusive — a channel definition query can filter for one direction or neither, but combining both would be contradictory, so the builder rejects the second call.
Source
Thrown at modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/ChannelDefinitionQueryImpl.java:249
protected void checkVersion(Integer version) {
if (version == null) {
throw new FlowableIllegalArgumentException("version is null");
} else if (version <= 0) {
throw new FlowableIllegalArgumentException("version must be positive");
}
}
@Override
public ChannelDefinitionQueryImpl latestVersion() {
this.latest = true;
return this;
}
@Override
public ChannelDefinitionQuery onlyInbound() {
if (onlyOutbound) {
throw new FlowableIllegalArgumentException("Cannot combine onlyInbound() with onlyOutbound() in the same query");
}
this.onlyInbound = true;
return this;
}
@Override
public ChannelDefinitionQuery onlyOutbound() {
if (onlyInbound) {
throw new FlowableIllegalArgumentException("Cannot combine onlyOutbound() with onlyInbound() in the same query");
}
this.onlyOutbound = true;
return this;
}
@Override
public ChannelDefinitionQuery implementation(String implementation) {
if (implementation == null) {
throw new FlowableIllegalArgumentException("implementation is null");View on GitHub (pinned to d6d39ce1c6)
Solutions
- Call only one of onlyInbound()/onlyOutbound() per query
- If you need both directions, remove both directional filters — the default query returns all channel definitions
- Restructure conditional logic so only one branch sets a directional filter
- Create two separate queries if you genuinely need inbound and outbound results distinguished
Example fix
// before
if (inbound) query.onlyInbound();
if (outbound) query.onlyOutbound(); // throws when both true
// after
if (inbound && !outbound) {
query.onlyInbound();
} else if (outbound && !inbound) {
query.onlyOutbound();
} Defensive patterns
Strategy: validation
Validate before calling
if (wantInbound && wantOutbound) {
throw new IllegalArgumentException("onlyInbound and onlyOutbound are mutually exclusive");
}
ChannelDefinitionQuery q = query;
if (wantInbound) q = q.onlyInbound();
if (wantOutbound) q = q.onlyOutbound(); Type guard
boolean isSingleDirection(boolean inbound, boolean outbound) {
return !(inbound && outbound);
} Try / catch
try {
query.onlyInbound();
} catch (FlowableIllegalArgumentException e) {
logger.warn("Conflicting direction filters: {}", e.getMessage());
query = channelDefinitionQuery(); // rebuild without conflicts
} Prevention
- Treat onlyInbound/onlyOutbound as exclusive: pick at most one per query
- Collect direction filters into an enum (INBOUND/OUTBOUND/ALL) instead of booleans
- Validate mutually exclusive UI/config options before building the query
- If both directions are needed, run two separate queries or drop the filters
When it happens
Trigger: Building a query with chained calls where onlyOutbound() precedes onlyInbound(), e.g. query.onlyOutbound().onlyInbound() or conditionally calling both from branching logic that assumed they could stack.
Common situations: Copy-pasting query building code and keeping both directional filters; feature flags that add both filters when misconfigured; misunderstanding the API as additive filtering.
Related errors
- Cannot combine onlyOutbound() with onlyInbound() in the same
- the query is already in an or statement
- endOr() can only be called after calling or()
- Invalid usage: cannot use deployed() and notDeployed() in th
- the query is already in an or statement
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/1b8205d4ab45570b.
Report an issue: GitHub.