{"record":{"id":"6f9960e3b36b4ba2","repo":"flowable/flowable-engine","slug":"invalid-multiple-sources-existingstreamsource","errorCode":null,"errorMessage":"invalid: multiple sources ${existingStreamSource} and ${newStreamSource}","messagePattern":"invalid: multiple sources (.+?) and (.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/parser/DmnParse.java","lineNumber":173,"sourceCode":"    public DmnParse sourceResource(String resource) {\n        if (name == null) {\n            name(resource);\n        }\n        setStreamSource(new ResourceStreamSource(resource));\n        return this;\n    }\n\n    public DmnParse 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    public String getSourceSystemId() {\n        return sourceSystemId;\n    }\n\n    public DmnParse setSourceSystemId(String sourceSystemId) {\n        this.sourceSystemId = sourceSystemId;\n        return this;\n    }\n\n    /*\n     * ------------------- GETTERS AND SETTERS -------------------\n     */\n\n    public boolean isValidateSchema() {","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/parser/DmnParse.java#L155-L191","documentation":"DmnParse (DmnParse in modules/flowable-dmn-engine/.../parser/DmnParse.java:173) can only hold one stream source. setStreamSource is the single choke point used by sourceInputStream, sourceUrl, sourceResource and sourceString; if a second source is set after a first one, the builder throws FlowableException('invalid: multiple sources ...'). This guards against ambiguous input where the DMN XML would be read from more than one place.","triggerScenarios":"Calling two of sourceInputStream/sourceUrl/sourceResource/sourceString on the same DmnParse instance, or calling any of them on an instance that already had a source set (e.g. reused parser/builder object).","commonSituations":"Reusing a shared parser or fluent builder for multiple DMN resources in a loop; copying example code that chains both sourceResource(...) and sourceInputStream(...); wiring a custom deployer that sets a default source and then the user's source.","solutions":["Create a new DmnParse instance for each DMN resource instead of reusing one.","Call exactly one source* method per parse; remove the redundant sourceInputStream/sourceUrl/sourceResource/sourceString call.","If you must replace the source, reset the parser (new instance) since streamSource has no setter-clear API."],"exampleFix":"// before\nDmnParse parse = new DmnParse(engineConfiguration);\nparse.sourceResource(\"a.dmn\");\nparse.sourceResource(\"b.dmn\"); // throws invalid: multiple sources\n// after\nDmnParse parseA = new DmnParse(engineConfiguration);\nparseA.sourceResource(\"a.dmn\");\nDmnParse parseB = new DmnParse(engineConfiguration);\nparseB.sourceResource(\"b.dmn\");","handlingStrategy":"validation","validationCode":"if (parserHasSource(parse)) { throw new IllegalStateException(\"DmnParse already has a source; create a new instance\"); }\nboolean parserHasSource(DmnParse p) { return p != null && p.getStreamSource() != null; }","typeGuard":"boolean canSetSource(DmnParse p) { return p.getStreamSource() == null; }","tryCatchPattern":null,"preventionTips":["Use a fresh DmnParse per DMN resource; never reuse builder instances in loops","Chain exactly one source* method per parse","Centralize parser construction in one helper that enforces single-source"],"tags":["flowable-dmn","parser","invalid-state","builder-misuse"],"backgroundTag":"invalid-state-transition","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"}