{"record":{"id":"008eea3d3ed876d7","repo":"flowable/flowable-engine","slug":"subscopeid-is-empty","errorCode":null,"errorMessage":"subScopeId is empty","messagePattern":"subScopeId 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":146,"sourceCode":"    @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) {\n            throw new FlowableIllegalArgumentException(\"Cannot combine subScopeId(String) with withoutSubScopeId() in the same query\");\n        }\n\n        this.subScopeId = subScopeId;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery subScopeIds(Collection<String> subScopeIds) {\n        if (withoutSubScopeId) {\n            throw new FlowableIllegalArgumentException(\"Cannot combine subScopeIds with withoutSubScopeId in the same query\");\n        }\n\n        this.subScopeIds = subScopeIds;\n        return this;","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/InternalVariableInstanceQueryImpl.java#L128-L164","documentation":"InternalVariableInstanceQueryImpl.subScopeId(String) throws FlowableIllegalArgumentException when the given subScopeId is null or empty, and additionally when withoutSubScopeId was already set on the same query. A concrete sub-scope id and 'no sub-scope' are mutually exclusive filters, and blank input is always invalid.","triggerScenarios":"Calling subScopeId(null) or subScopeId(\"\"); or calling subScopeId(x) after withoutSubScopeId() on the same builder instance.","commonSituations":"Sub-scope id taken from an uninitialized variable; filter assembly that sets withoutSubScopeId earlier and later also sets a concrete id; shared query builders mutated by multiple code paths.","solutions":["Pass a valid non-empty subScopeId and ensure withoutSubScopeId() is not called on the same query","Use either subScopeId(...) or withoutSubScopeId(), not both","Guard the call site for null/empty before building"],"exampleFix":"// before\nquery.withoutSubScopeId();\nquery.subScopeId(subScopeId); // throws\n// after\nif (subScopeId != null && !subScopeId.isEmpty()) {\n    query.subScopeId(subScopeId);\n} else {\n    query.withoutSubScopeId();\n}","handlingStrategy":"validation","validationCode":"if (subScopeId == null || subScopeId.isEmpty()) { throw new IllegalArgumentException(\"subScopeId required\"); } if (useWithoutSubScopeId) { throw new IllegalStateException(\"subScopeId and withoutSubScopeId are mutually exclusive\"); }","typeGuard":"boolean hasSubScopeId(String id) { return id != null && !id.isEmpty(); }","tryCatchPattern":"try { query.subScopeId(subScopeId); } catch (FlowableIllegalArgumentException e) { throw new QueryConfigurationException(e.getMessage(), e); }","preventionTips":["Branch between concrete subScopeId and withoutSubScopeId, never both","Validate sub-scope ids sourced from variables before use","Keep query building in a single helper that enforces the exclusivity rules"],"tags":["flowable","query-builder","conflicting-filters","argument-validation"],"backgroundTag":"mutually-exclusive-options","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"}