{"record":{"id":"6dc263f03ee79c28","repo":"flowable/flowable-engine","slug":"scopeid-is-empty-6dc263","errorCode":null,"errorMessage":"scopeId is empty","messagePattern":"scopeId is empty","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/InternalVariableInstanceQueryImpl.java","lineNumber":131,"sourceCode":"            throw new FlowableIllegalArgumentException(\"executionIds is null or empty\");\n        }\n        this.executionIds = executionIds;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery withoutTaskId() {\n        if (taskId != null || taskIds != null) {\n            throw new FlowableIllegalArgumentException(\"Cannot combine withoutTaskId() with task(String) or taskIds(Collection) in the same query\");\n        }\n        this.withoutTaskId = true;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery scopeId(String scopeId) {\n        if (StringUtils.isEmpty(scopeId)) {\n            throw new FlowableIllegalArgumentException(\"scopeId is empty\");\n        }\n        this.scopeId = scopeId;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery scopeIds(Collection<String> scopeIds) {\n        this.scopeIds = scopeIds;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery subScopeId(String subScopeId) {\n        if (StringUtils.isEmpty(subScopeId)) {\n            throw new FlowableIllegalArgumentException(\"subScopeId is empty\");\n        }\n\n        if (withoutSubScopeId) {","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/InternalVariableInstanceQueryImpl.java#L113-L149","documentation":"InternalVariableInstanceQueryImpl.scopeId(String) throws FlowableIllegalArgumentException when the given scopeId is null or empty. Scope-scoped variables (e.g. CMMN case or other scoped storage) require a concrete scope identifier, so blank input is rejected eagerly before query execution.","triggerScenarios":"Calling scopeId(null) or scopeId(\"\") — e.g. a scope id variable not yet initialized, an id read from an empty payload field, or querying outside any scope.","commonSituations":"Case/task scope id sourced from a request body not yet populated; code invoked before the scoped entity is created; passing the wrong variable that happens to be empty.","solutions":["Resolve a valid non-empty scope id before building the query","Short-circuit and return an empty result when no scope id is available","Validate the scope id at your API boundary"],"exampleFix":"// before\nquery.scopeId(scopeId); // throws when blank\n// after\nif (scopeId != null && !scopeId.isEmpty()) {\n    query.scopeId(scopeId);\n} else {\n    return Collections.emptyList();\n}","handlingStrategy":"validation","validationCode":"if (scopeId == null || scopeId.isEmpty()) { throw new IllegalArgumentException(\"scopeId required\"); }","typeGuard":"boolean hasScopeId(String id) { return id != null && !id.isEmpty(); }","tryCatchPattern":"try { query.scopeId(scopeId); } catch (FlowableIllegalArgumentException e) { log.warn(\"Missing scopeId for variable query\", e); return Collections.emptyList(); }","preventionTips":["Validate scope ids from request payloads before querying","Ensure scoped entities exist before querying their variables","Check that you pass the scope id, not a related-but-empty variable"],"tags":["flowable","query-builder","argument-validation","null-argument"],"backgroundTag":"empty-required-field","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}