{"record":{"id":"5344f6262b6bfbda","repo":"flowable/flowable-engine","slug":"provided-scope-type-is-null","errorCode":null,"errorMessage":"Provided scope type is null","messagePattern":"Provided scope type is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/EventSubscriptionQueryImpl.java","lineNumber":349,"sourceCode":"    @Override\n    public EventSubscriptionQueryImpl scopeDefinitionKey(String scopeDefinitionKey) {\n        if (scopeDefinitionKey == null) {\n            throw new FlowableIllegalArgumentException(\"Provided scope definition key is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.scopeDefinitionKey = scopeDefinitionKey;\n        } else {\n            this.scopeDefinitionKey = scopeDefinitionKey;\n        }\n\n        return this;\n    }\n    \n    @Override\n    public EventSubscriptionQueryImpl scopeType(String scopeType) {\n        if (scopeType == null) {\n            throw new FlowableIllegalArgumentException(\"Provided scope type is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.scopeType = scopeType;\n        } else {\n            this.scopeType = scopeType;\n        }\n\n        return this;\n    }\n\n    @Override\n    public EventSubscriptionQueryImpl createdBefore(Date beforeTime) {\n        if (beforeTime == null) {\n            throw new FlowableIllegalArgumentException(\"created before time is null\");\n        }\n\n        if (inOrStatement) {","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-eventsubscription-service/src/main/java/org/flowable/eventsubscription/service/impl/EventSubscriptionQueryImpl.java#L331-L367","documentation":"EventSubscriptionQueryImpl.scopeType() validates its argument before storing it. Flowable throws FlowableIllegalArgumentException when a null scope type is passed, because a null scopeType would silently produce an ill-defined query filter. The library treats query setters as strict API: null is never accepted as a value.","triggerScenarios":"Calling eventSubscriptionQuery.scopeType(null), e.g. when the scope type comes from an unset variable, a missing BPMN property, or a configuration map lookup that returned null.","commonSituations":"Passing a scope type read from a process variable or external config that was never populated; refactoring code that previously used scope types like 'bpmn' or 'cmmn' but the source of the value became optional.","solutions":["Check the scopeType value for null before calling scopeType(), and skip the filter or supply a default like \"bpmn\"","Fix the upstream source (variable, config, property file) so a valid scope type is populated","If the filter is conditional, only invoke scopeType() when a non-null value exists"],"exampleFix":"// before\nquery.scopeType(processScopeType);\n\n// after\nif (processScopeType != null) {\n    query.scopeType(processScopeType);\n}","handlingStrategy":"validation","validationCode":"if (scopeType == null || scopeType.isBlank()) {\n    throw new IllegalArgumentException(\"scopeType must be set before building query\");\n}","typeGuard":"boolean hasScopeType(String s) { return s != null && !s.isBlank(); }","tryCatchPattern":"try {\n    query.scopeType(scopeType);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"scopeType was null, applying default\", e);\n    query.scopeType(\"bpmn\");\n}","preventionTips":["Null-check optional filter values before applying them to the query","Centralize query building in a helper that skips null criteria","Never pass config-sourced strings straight into Flowable query setters"],"tags":["flowable","query","null-check","event-subscription"],"backgroundTag":"null-argument","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"}