{"record":{"id":"24e0edc2bd9c4c6a","repo":"flowable/flowable-engine","slug":"subscopeid-is-null-24e0ed","errorCode":null,"errorMessage":"subScopeId is null","messagePattern":"subScopeId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java","lineNumber":157,"sourceCode":"            throw new FlowableIllegalArgumentException(\"status is null\");\n        }\n        this.status = status;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery scopeId(String scopeId) {\n        if (scopeId == null) {\n            throw new FlowableIllegalArgumentException(\"scopeId is null\");\n        }\n        this.scopeId = scopeId;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery subScopeId(String subScopeId) {\n        if (subScopeId == null) {\n            throw new FlowableIllegalArgumentException(\"subScopeId is null\");\n        }\n        this.subScopeId = subScopeId;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery scopeType(String scopeType) {\n        if (scopeType == null) {\n            throw new FlowableIllegalArgumentException(\"scopeType is null\");\n        }\n        this.scopeType = scopeType;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery tenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"tenantId is null\");","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java#L139-L175","documentation":"BatchPartQueryImpl.subScopeId() throws FlowableIllegalArgumentException when the subScopeId argument is null. The setter validates non-null because subScopeId is used as an equality filter on the SUB_SCOPE_ID_ column and null would be ambiguous.","triggerScenarios":"Calling batchPartQuery().subScopeId(null), or passing a subScopeId extracted from a variable/DTO that was never populated.","commonSituations":"Querying batch parts for a sub-scope that does not exist; copying scope/subScope values from a partially initialized entity.","solutions":["Pass a non-null subScopeId string","Omit the .subScopeId(...) call when sub-scope filtering is not needed","Check the source object for a populated subScopeId before chaining the filter"],"exampleFix":"// before\nquery.subScopeId(part.getSubScopeId()); // may be null\n// after\nif (part.getSubScopeId() != null) {\n    query.subScopeId(part.getSubScopeId());\n}","handlingStrategy":"validation","validationCode":"if (subScopeId == null) {\n    throw new IllegalArgumentException(\"subScopeId must be non-null before calling BatchPartQuery.subScopeId()\");\n}\nquery.subScopeId(subScopeId);","typeGuard":"boolean hasSubScopeId(String s) { return s != null && !s.isEmpty(); }","tryCatchPattern":"try {\n    query.subScopeId(subScopeId);\n} catch (FlowableIllegalArgumentException e) {\n    // degrade to scope-only query\n    query.scopeId(scopeId);\n}","preventionTips":["Populate subScopeId on DTOs before passing them into query builders","Apply the sub-scope filter only when present","Prefer Optional<String> internally and only call the setter when present"],"tags":["java","flowable","null-check","query-api"],"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"}