{"record":{"id":"3924f41b851dcc4f","repo":"flowable/flowable-engine","slug":"cannot-combine-scopetype-string-with-onlybpmn-i","errorCode":null,"errorMessage":"Cannot combine scopeType(String) with onlyBpmn() in the same query","messagePattern":"Cannot combine scopeType\\(String\\) 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":71,"sourceCode":"        }\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);\n    }\n\n    @Override\n    public ExternalWorkerJobAcquireBuilder scopeType(String scopeType) {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/ExternalWorkerJobAcquireBuilderImpl.java#L53-L89","documentation":"ExternalWorkerJobAcquireBuilderImpl.onlyBpmn() rejects calls when an explicit scopeType(String) was already set, because onlyBpmn() is just a shortcut for scopeType(BPMN) and combining them directly conflicts. Flowable throws FlowableIllegalArgumentException.","triggerScenarios":"Calling builder.scopeType(\"cmmn\") (or any non-null scopeType) and then onlyBpmn() on the same builder.","commonSituations":"Mixing the convenience methods with the generic scopeType() when scope type comes from configuration.","solutions":["Use only scopeType(String) when the scope is dynamic","Use only onlyBpmn()/onlyCmmn() when the scope is static","Choose one mechanism per builder instance"],"exampleFix":"// before\nbuilder.scopeType(cfgScope).onlyBpmn();\n// after\nbuilder.scopeType(cfgScope);","handlingStrategy":"validation","validationCode":"if (scopeTypeFromConfig != null && useOnlyBpmnShortcut) throw new IllegalArgumentException(\"cannot combine scopeType() with onlyBpmn()\");","typeGuard":null,"tryCatchPattern":"try { builder.onlyBpmn(); } catch (FlowableIllegalArgumentException e) { if (!e.getMessage().contains(\"Cannot combine\")) throw e; /* switch to scopeType(String) only */ }","preventionTips":["Standardize on scopeType(String) for dynamic scopes","Document that onlyBpmn()/onlyCmmn() are static-only shortcuts","Code-review builder chains for mixed scope APIs"],"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"}