{"record":{"id":"36f293c489f859c6","repo":"flowable/flowable-engine","slug":"provided-sub-scope-id-is-null-36f293","errorCode":null,"errorMessage":"Provided sub scope id is null","messagePattern":"Provided sub scope id 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":278,"sourceCode":"            this.scopeIds = scopeIds;\n        }\n        return this;\n    }\n\n    @Override\n    public JobQuery withoutScopeId() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.withoutScopeId = true;\n        } else {\n            this.withoutScopeId = true;\n        }\n        return this;\n    }\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;","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/JobQueryImpl.java#L260-L296","documentation":"JobQueryImpl.subScopeId(String) rejects null input with FlowableIllegalArgumentException before assigning the value to the query (or the active or-query object). The library throws eagerly because a null subScopeId filter is meaningless and would produce an invalid query. Callers such as planItemInstanceId delegate into this method, so a null there also surfaces here.","triggerScenarios":"Calling jobQuery.subScopeId(null) directly, or jobQuery.planItemInstanceId(null) which delegates to subScopeId(null). Also triggered inside or(...) blocks.","commonSituations":"Passing a plan item instance id fetched from a CMMN runtime API that returned null (item not found); copying ids between process engines where the source variable was never populated; building queries from optional request parameters.","solutions":["Verify the subScopeId/planItemInstanceId variable is non-null before building the query","If the id came from a lookup, check that the lookup actually found the entity before querying jobs","Skip the subScopeId call when the value is null and use a different filter strategy","Log/inspect the upstream object to see why the id was never assigned"],"exampleFix":"// before\njobQuery.planItemInstanceId(planItemInstanceId);\n// after\nif (planItemInstanceId != null) {\n    jobQuery.planItemInstanceId(planItemInstanceId);\n} else {\n    throw new IllegalStateException(\"Plan item instance id required for job query\");\n}","handlingStrategy":"validation","validationCode":"if (subScopeId == null) { throw new IllegalArgumentException(\"subScopeId must not be null\"); }\njobQuery.subScopeId(subScopeId);","typeGuard":"boolean hasSubScopeId(String id) { return id != null; }","tryCatchPattern":"try {\n    jobQuery.subScopeId(subScopeId);\n} catch (FlowableIllegalArgumentException e) {\n    logger.warn(\"subScopeId was null\", e);\n}","preventionTips":["Verify plan item instance ids exist before scoping job queries","Null-check ids copied from CMMN runtime entities","Prefer caseInstanceId filtering when the sub scope id is unknown"],"tags":["flowable","java","null-check","cmmn"],"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"}