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

  1. Call only one of onlyInbound()/onlyOutbound() per query
  2. If you need both directions, remove both directional filters — the default query returns all channel definitions
  3. Restructure conditional logic so only one branch sets a directional filter
  4. 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

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


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