{"record":{"id":"4e7f3ddc654cdfa2","repo":"flowable/flowable-engine","slug":"cannot-combine-scopetype-string-with-onlycmmn-i","errorCode":null,"errorMessage":"Cannot combine scopeType(String) with onlyCmmn() in the same query","messagePattern":"Cannot combine scopeType\\(String\\) with onlyCmmn\\(\\) 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":83,"sourceCode":"    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) {\n        this.scopeType = scopeType;\n        return this;\n    }\n\n    @Override\n    public ExternalWorkerJobAcquireBuilder tenantId(String tenantId) {\n        this.tenantId = tenantId;\n        return this;\n    }\n\n    @Override\n    public ExternalWorkerJobAcquireBuilder forUserOrGroups(String userId, Collection<String> groups) {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/ExternalWorkerJobAcquireBuilderImpl.java#L65-L101","documentation":"ExternalWorkerJobAcquireBuilderImpl.onlyCmmn() rejects calls when an explicit scopeType(String) was already set on the builder, since onlyCmmn() is a shortcut for scopeType(CMMN). Flowable throws FlowableIllegalArgumentException to prevent conflicting scope values.","triggerScenarios":"Calling builder.scopeType(\"bpmn\") (or any non-null scopeType) followed by onlyCmmn().","commonSituations":"Mixing dynamic scopeType from configuration with static convenience methods.","solutions":["Pick either scopeType(String) or the convenience methods, not both","Validate the builder call sequence in shared helper code","Reset the builder when changing scope strategy"],"exampleFix":"// before\nbuilder.scopeType(\"bpmn\").onlyCmmn();\n// after\nbuilder.scopeType(\"bpmn\");","handlingStrategy":"validation","validationCode":"if (scopeTypeFromConfig != null && useOnlyCmmnShortcut) throw new IllegalArgumentException(\"cannot combine scopeType() with onlyCmmn()\");","typeGuard":null,"tryCatchPattern":"try { builder.onlyCmmn(); } catch (FlowableIllegalArgumentException e) { if (!e.getMessage().contains(\"Cannot combine\")) throw e; /* switch to scopeType(String) only */ }","preventionTips":["Choose one scope-selection API per codebase","Derive scopeType from config as the single source of truth","Lint/review for mixed onlyBpmn/onlyCmmn/scopeType chains"],"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"}