{"record":{"id":"7f782c6c5481819a","repo":"flowable/flowable-engine","slug":"provided-scope-type-is-null-7f782c","errorCode":null,"errorMessage":"Provided scope type is null","messagePattern":"Provided scope type is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/JobQueryImpl.java","lineNumber":291,"sourceCode":"    }\n\n    @Override\n    public JobQueryImpl subScopeId(String subScopeId) {\n        if (subScopeId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided sub scope id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.subScopeId = subScopeId;\n        } else {\n            this.subScopeId = subScopeId;\n        }\n        return this;\n    }\n\n    @Override\n    public JobQueryImpl scopeType(String scopeType) {\n        if (scopeType == null) {\n            throw new FlowableIllegalArgumentException(\"Provided scope type is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.scopeType = scopeType;\n        } else {\n            this.scopeType = scopeType;\n        }\n        return this;\n    }\n\n    @Override\n    public JobQueryImpl scopeDefinitionId(String scopeDefinitionId) {\n        if (scopeDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided scope definitionid is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.scopeDefinitionId = scopeDefinitionId;\n        } else {\n            this.scopeDefinitionId = scopeDefinitionId;","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/JobQueryImpl.java#L273-L309","documentation":"JobQueryImpl.scopeType(String) validates that the scope type filter is non-null and throws FlowableIllegalArgumentException otherwise. Scope type (e.g. ScopeTypes.BPMN or ScopeTypes.CMMN) tells the job query which engine partition to search; a null type would make the query ambiguous, so it is rejected immediately. Note this method is also invoked internally by caseInstanceId/caseDefinitionId/planItemInstanceId, but those already null-check their own inputs first.","triggerScenarios":"Calling jobQuery.scopeType(null) directly, or via an or(...) block. Any code path that builds the scope type dynamically from a nullable config or enum lookup that resolved to null.","commonSituations":"Resolving scope type from a string config value that was missing; a switch/lookup returning null for an unknown scope name; generic query-builder code passing through unset fields.","solutions":["Pass a valid ScopeTypes constant (BPMN or CMMN) instead of null","Validate the scope-type variable before calling; default to a known constant when unset","Fix the config/lookup that was supposed to yield the scope type","If scope filtering is not needed, omit the call rather than passing null"],"exampleFix":"// before\njobQuery.scopeType(scopeType); // scopeType may be null\n// after\nif (scopeType != null) {\n    jobQuery.scopeType(scopeType);\n} else {\n    jobQuery.scopeType(ScopeTypes.BPMN);\n}","handlingStrategy":"validation","validationCode":"if (scopeType == null) { scopeType = ScopeTypes.BPMN; }\njobQuery.scopeType(scopeType);","typeGuard":"boolean isValidScopeType(String t) { return ScopeTypes.BPMN.equals(t) || ScopeTypes.CMMN.equals(t); }","tryCatchPattern":"try {\n    jobQuery.scopeType(scopeType);\n} catch (FlowableIllegalArgumentException e) {\n    logger.warn(\"scopeType was null\", e);\n}","preventionTips":["Always use ScopeTypes constants rather than free-form strings","Validate scope-type configuration at startup","Never pass unset config values directly into query builders"],"tags":["flowable","java","null-check","scope-type"],"backgroundTag":"null-argument","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"}