{"record":{"id":"9ebed96e1eba319a","repo":"flowable/flowable-engine","slug":"scopetype-is-empty-9ebed9","errorCode":null,"errorMessage":"scopeType is empty","messagePattern":"scopeType 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":179,"sourceCode":"        }\n\n        this.subScopeIds = subScopeIds;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery withoutSubScopeId() {\n        if (subScopeId != null) {\n            throw new FlowableIllegalArgumentException(\"Cannot combine withoutSubScopeId() with subScopeId(String) in the same query\");\n        }\n        this.withoutSubScopeId = true;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery scopeType(String scopeType) {\n        if (StringUtils.isEmpty(scopeType)) {\n            throw new FlowableIllegalArgumentException(\"scopeType is empty\");\n        }\n        this.scopeType = scopeType;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery scopeTypes(Collection<String> scopeTypes) {\n        this.scopeTypes = scopeTypes;\n        return this;\n    }\n\n    @Override\n    public InternalVariableInstanceQuery name(String name) {\n        if (StringUtils.isEmpty(name)) {\n            throw new FlowableIllegalArgumentException(\"name is empty\");\n        }\n        this.name = name;\n        return this;","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/InternalVariableInstanceQueryImpl.java#L161-L197","documentation":"InternalVariableInstanceQueryImpl.scopeType(String) requires a non-empty scope type (e.g. \"bpmn\", \"cmmn\", \"task\") because the persistence layer queries variables by scope type discriminator. An empty or null string cannot match any scope, so FlowableIllegalArgumentException(\"scopeType is empty\") is thrown.","triggerScenarios":"Calling query.scopeType(\"\") or query.scopeType(null) — StringUtils.isEmpty check at InternalVariableInstanceQueryImpl.java:179 fires.","commonSituations":"Scope type passed from a config property, request parameter, or enum lookup that resolves to an empty string; forgetting to set a default scope type in a service wrapper.","solutions":["Pass a valid scope type such as ScopeTypes.BPMN (\"bpmn\") or ScopeTypes.CMMN (\"cmmn\").","Validate the scopeType input before building the query and reject empties upstream.","If scopeType is optional in your flow, skip calling scopeType(...) rather than passing an empty string."],"exampleFix":"// before\nquery.scopeType(scopeType == null ? \"\" : scopeType); // throws when null\n\n// after\nif (StringUtils.isNotEmpty(scopeType)) {\n    query.scopeType(scopeType);\n}","handlingStrategy":"validation","validationCode":"if (scopeType == null || scopeType.isEmpty()) {\n    throw new IllegalArgumentException(\"scopeType must be a non-empty value like \\\"bpmn\\\" or \\\"cmmn\\\"\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    query.scopeType(scopeType);\n} catch (FlowableIllegalArgumentException e) {\n    // fall back to a default scope\n    query.scopeType(ScopeTypes.BPMN);\n}","preventionTips":["Use ScopeTypes constants instead of raw strings.","Validate config/request input for scope type at the boundary.","Skip optional scopeType calls rather than passing empty strings."],"tags":["query","validation","empty-string"],"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"}