flowable/flowable-engine · error · FlowableException

invalid: multiple sources

Error message

invalid: multiple sources ${this.streamSource} and ${streamSource}

What it means

An EventDefinitionParse instance may only have one input source (string, stream, URL, or resource). setStreamSource guards this invariant: if a source was already set, any further source call throws FlowableException listing both sources.

Solutions

  1. Call only ONE source-setting method per EventDefinitionParse instance
  2. Create a new EventDefinitionParse object for each source you need to parse
  3. Track which source was set and guard the second call with an if/else instead of chaining both

Example fix

// before
EventDefinitionParse parse = new EventDefinitionParse();
parse.sourceResource("events/a.json");
parse.sourceString(jsonString); // throws
// after
parse.sourceString(jsonString); // single source only
// or new instance per source:
new EventDefinitionParse().sourceResource("events/a.json");
Defensive patterns

Strategy: validation

Validate before calling

if (parse != null) { throw new IllegalStateException("Source already set on this EventDefinitionParse"); }

Try / catch

try {
    parse.sourceString(json);
} catch (org.flowable.common.engine.api.FlowableException e) {
    if (e.getMessage().startsWith("invalid: multiple sources")) {
        parse = new EventDefinitionParse().sourceString(json);
    } else throw e;
}

Prevention

When it happens

Trigger: Chaining more than one source-setting call on the same EventDefinitionParse, e.g. calling sourceString(...) after sourceInputStream(...), or sourceUrl(...) after sourceResource(...), on the same builder object.

Common situations: Copy-pasted builder code where both resource and string sources are configured; conditional code that sets a default source then also sets a configured one; reusing a parse object for a second definition instead of creating a new one.

Related errors


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

Appendix: source

Thrown at modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/parser/EventDefinitionParse.java:153

    public EventDefinitionParse sourceResource(String resource) {
        if (name == null) {
            name(resource);
        }
        setStreamSource(new ResourceStreamSource(resource));
        return this;
    }

    public EventDefinitionParse sourceString(String string) {
        if (name == null) {
            name("string");
        }
        setStreamSource(new StringStreamSource(string));
        return this;
    }

    protected void setStreamSource(StreamSource streamSource) {
        if (this.streamSource != null) {
            throw new FlowableException("invalid: multiple sources " + this.streamSource + " and " + streamSource);
        }
        this.streamSource = streamSource;
    }

    /*
     * ------------------- GETTERS AND SETTERS -------------------
     */

    public List<EventDefinitionEntity> getEventDefinitions() {
        return eventDefinitions;
    }

    public EventDeploymentEntity getDeployment() {
        return deployment;
    }

    public void setDeployment(EventDeploymentEntity deployment) {
        this.deployment = deployment;

View on GitHub (pinned to d6d39ce1c6)