{"record":{"id":"8eced4572ac662d7","repo":"flowable/flowable-engine","slug":"cannot-combine-onlycmmn-with-onlybpmn-in-the-s","errorCode":null,"errorMessage":"Cannot combine onlyCmmn() with onlyBpmn() in the same query","messagePattern":"Cannot combine onlyCmmn\\(\\) with onlyBpmn\\(\\) in the same query","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/ExternalWorkerJobAcquireBuilderImpl.java","lineNumber":67,"sourceCode":"    @Override\n    public ExternalWorkerJobAcquireBuilder topic(String topic, Duration lockDuration) {\n        if (topic == null) {\n            throw new FlowableIllegalArgumentException(\"topic is null\");\n        }\n\n        if (lockDuration == null) {\n            throw new FlowableIllegalArgumentException(\"lockDuration is null\");\n        }\n\n        this.topic = topic;\n        this.lockDuration = lockDuration;\n        return this;\n    }\n\n    @Override\n    public ExternalWorkerJobAcquireBuilder onlyBpmn() {\n        if (ScopeTypes.CMMN.equals(scopeType)) {\n            throw new FlowableIllegalArgumentException(\"Cannot combine onlyCmmn() with onlyBpmn() in the same query\");\n        }\n\n        if (scopeType != null) {\n            throw new FlowableIllegalArgumentException(\"Cannot combine scopeType(String) with onlyBpmn() in the same query\");\n        }\n        return scopeType(ScopeTypes.BPMN);\n    }\n\n    @Override\n    public ExternalWorkerJobAcquireBuilder onlyCmmn() {\n        if (ScopeTypes.BPMN.equals(scopeType)) {\n            throw new FlowableIllegalArgumentException(\"Cannot combine onlyBpmn() with onlyCmmn() in the same query\");\n        }\n\n        if (scopeType != null) {\n            throw new FlowableIllegalArgumentException(\"Cannot combine scopeType(String) with onlyCmmn() in the same query\");\n        }\n        return scopeType(ScopeTypes.CMMN);","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/ExternalWorkerJobAcquireBuilderImpl.java#L49-L85","documentation":"ExternalWorkerJobAcquireBuilderImpl.onlyBpmn() restricts acquisition to BPMN jobs. If scopeType is already CMMN (e.g. onlyCmmn() was called first), combining the two is ambiguous, so Flowable throws FlowableIllegalArgumentException.","triggerScenarios":"Calling onlyCmmn() then onlyBpmn() (in either order) on the same acquire builder.","commonSituations":"Accidentally chaining both scope restrictions when building a flexible acquisition request; copy-paste of builder calls.","solutions":["Use only one scope restriction per builder","Reset/recreate the builder when switching scope","Use scopeType(String) once with a variable value instead of chaining fixed calls"],"exampleFix":"// before\nbuilder.onlyCmmn().onlyBpmn();\n// after\nbuilder.onlyBpmn();","handlingStrategy":"validation","validationCode":"if (useBpmn && useCmmn) throw new IllegalArgumentException(\"onlyBpmn and onlyCmmn are mutually exclusive\");","typeGuard":null,"tryCatchPattern":"try { builder.onlyBpmn(); } catch (FlowableIllegalArgumentException e) { if (!e.getMessage().contains(\"Cannot combine\")) throw e; /* resolve conflicting scope flags */ }","preventionTips":["Model scope choice as an enum instead of independent booleans","Use if/else, not sequential builder calls, for scope selection","Test builder chains with both flags set"],"tags":["flowable","external-worker","conflicting-options","validation"],"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"}