{"record":{"id":"fe4d0f505a2953b8","repo":"flowable/flowable-engine","slug":"invalid-multiple-sources-this-streamsource-and-fe4d0f","errorCode":null,"errorMessage":"invalid: multiple sources ${this.streamSource} and ${streamSource}","messagePattern":"invalid: multiple sources (.+?) and (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/parser/EventDefinitionParse.java","lineNumber":153,"sourceCode":"    public EventDefinitionParse sourceResource(String resource) {\n        if (name == null) {\n            name(resource);\n        }\n        setStreamSource(new ResourceStreamSource(resource));\n        return this;\n    }\n\n    public EventDefinitionParse sourceString(String string) {\n        if (name == null) {\n            name(\"string\");\n        }\n        setStreamSource(new StringStreamSource(string));\n        return this;\n    }\n\n    protected void setStreamSource(StreamSource streamSource) {\n        if (this.streamSource != null) {\n            throw new FlowableException(\"invalid: multiple sources \" + this.streamSource + \" and \" + streamSource);\n        }\n        this.streamSource = streamSource;\n    }\n\n    /*\n     * ------------------- GETTERS AND SETTERS -------------------\n     */\n\n    public List<EventDefinitionEntity> getEventDefinitions() {\n        return eventDefinitions;\n    }\n\n    public EventDeploymentEntity getDeployment() {\n        return deployment;\n    }\n\n    public void setDeployment(EventDeploymentEntity deployment) {\n        this.deployment = deployment;","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/parser/EventDefinitionParse.java#L135-L171","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Call only ONE source-setting method per EventDefinitionParse instance","Create a new EventDefinitionParse object for each source you need to parse","Track which source was set and guard the second call with an if/else instead of chaining both"],"exampleFix":"// before\nEventDefinitionParse parse = new EventDefinitionParse();\nparse.sourceResource(\"events/a.json\");\nparse.sourceString(jsonString); // throws\n// after\nparse.sourceString(jsonString); // single source only\n// or new instance per source:\nnew EventDefinitionParse().sourceResource(\"events/a.json\");","handlingStrategy":"validation","validationCode":"if (parse != null) { throw new IllegalStateException(\"Source already set on this EventDefinitionParse\"); }","typeGuard":null,"tryCatchPattern":"try {\n    parse.sourceString(json);\n} catch (org.flowable.common.engine.api.FlowableException e) {\n    if (e.getMessage().startsWith(\"invalid: multiple sources\")) {\n        parse = new EventDefinitionParse().sourceString(json);\n    } else throw e;\n}","preventionTips":["Set exactly one source (string/stream/url/resource) per EventDefinitionParse","Never reuse a parse builder for multiple definitions","Structure conditional source selection with if/else, not sequential calls"],"tags":["java","event-registry","builder-usage"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}