{"record":{"id":"e53e6d37cfb71f26","repo":"flowable/flowable-engine","slug":"scopeid-is-null-e53e6d","errorCode":null,"errorMessage":"scopeId is null","messagePattern":"scopeId 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":148,"sourceCode":"            throw new FlowableIllegalArgumentException(\"batchSearchKey2 is null\");\n        }\n        this.batchSearchKey2 = searchKey2;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery status(String status) {\n        if (status == null) {\n            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\");","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java#L130-L166","documentation":"BatchPartQueryImpl.scopeId() throws FlowableIllegalArgumentException when the scopeId argument is null. Flowable validates the argument at setter time because a null scope id is meaningless as a filter on the batch part SCOPE_ID_ column. The query builder fails fast rather than at query execution.","triggerScenarios":"Calling batchPartQuery().scopeId(null), or forwarding a scopeId obtained from a process/execution context that is null (e.g. a batch part with no scope).","commonSituations":"Building a batch part query from a callback where scope info was not propagated; passing result of execution.getScopeId() for a non-scoped execution.","solutions":["Pass a valid non-null scope id string","Skip the .scopeId(...) call when the value is null if filtering by scope is optional","Verify the entity you derived the scopeId from actually has a scope set"],"exampleFix":"// before\nquery.scopeId(execution.getScopeId()); // may be null\n// after\nString scopeId = execution.getScopeId();\nif (scopeId != null) {\n    query.scopeId(scopeId);\n}","handlingStrategy":"validation","validationCode":"if (scopeId == null) {\n    throw new IllegalArgumentException(\"scopeId must be non-null before calling BatchPartQuery.scopeId()\");\n}\nquery.scopeId(scopeId);","typeGuard":"boolean hasScopeId(String s) { return s != null && !s.isEmpty(); }","tryCatchPattern":"try {\n    query.scopeId(scopeId);\n} catch (FlowableIllegalArgumentException e) {\n    logger.warn(\"scopeId was null, skipping scope filter\");\n}","preventionTips":["Check the source entity actually has a scope set","Conditionally apply scope filters instead of nulling them","Log when scope context is missing so silent null propagation is visible"],"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"}