{"record":{"id":"e9e28f3969a6c9c1","repo":"flowable/flowable-engine","slug":"cannot-combine-onlytimers-with-onlyexternalworke","errorCode":null,"errorMessage":"Cannot combine onlyTimers() with onlyExternalWorkers() in the same query","messagePattern":"Cannot combine onlyTimers\\(\\) with onlyExternalWorkers\\(\\) 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/DeadLetterJobQueryImpl.java","lineNumber":468,"sourceCode":"            throw new FlowableIllegalArgumentException(\"Cannot combine onlyExternalWorkers() with onlyMessages() in the same query\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.onlyMessages = true;\n        } else {\n            this.onlyMessages = true;\n        }\n        return this;\n    }\n\n    @Override\n    public DeadLetterJobQueryImpl externalWorkers() {\n        if (onlyMessages) {\n            throw new FlowableIllegalArgumentException(\"Cannot combine onlyMessages() with onlyExternalWorkers() in the same query\");\n        }\n\n        if (onlyTimers) {\n            throw new FlowableIllegalArgumentException(\"Cannot combine onlyTimers() with onlyExternalWorkers() in the same query\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.onlyExternalWorkers = true;\n        } else {\n            this.onlyExternalWorkers = true;\n        }\n        return this;\n    }\n\n\n    @Override\n    public DeadLetterJobQueryImpl duedateHigherThan(Date date) {\n        if (date == null) {\n            throw new FlowableIllegalArgumentException(\"Provided date is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.duedateHigherThan = date;","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/DeadLetterJobQueryImpl.java#L450-L486","documentation":"DeadLetterJobQueryImpl.externalWorkers() rejects a query that already narrowed to timer jobs. If the onlyTimers flag is set, calling externalWorkers() would combine two exclusive categories, so FlowableIllegalArgumentException is thrown. Timer dead-letter jobs and external-worker dead-letter jobs cannot be selected together this way.","triggerScenarios":"Calling deadLetterJobQuery().timers() ... .externalWorkers(). The check fires in externalWorkers() when onlyTimers is true.","commonSituations":"Conditionally adding category filters where both timer and external-worker selections are possible; a refactoring that replaced timers() with externalWorkers() but left the original call.","solutions":["Choose exactly one category filter: timers() or externalWorkers(), not both","Consolidate category selection into a single mutually exclusive decision point","Build a new query object if you need to run separate queries per category"],"exampleFix":"// before\nmgmt.createDeadLetterJobQuery().timers().externalWorkers();\n// after\nmgmt.createDeadLetterJobQuery().externalWorkers(); // one category per query","handlingStrategy":"validation","validationCode":"if (useTimers && useExternalWorkers) { throw new IllegalArgumentException(\"timers() and externalWorkers() are mutually exclusive\"); }","typeGuard":null,"tryCatchPattern":"try { query = mgmt.createDeadLetterJobQuery().externalWorkers(); } catch (FlowableIllegalArgumentException e) { log.error(\"Conflicting category filters\", e); }","preventionTips":["Model the category as a single enum field, not multiple booleans","Never conditionally chain two category methods on one query","Document that DeadLetterJobQuery supports exactly one job category"],"tags":["flowable","job-query","illegal-argument","query-builder"],"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-14T05:17:10.506Z"}