{"record":{"id":"bc8ee60470a2db09","repo":"flowable/flowable-engine","slug":"scopetype-is-null","errorCode":null,"errorMessage":"scopeType is null","messagePattern":"scopeType is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-batch-service/src/main/java/org/flowable/batch/service/BatchPartBuilderImpl.java","lineNumber":101,"sourceCode":"            throw new FlowableIllegalArgumentException(\"scopeId is null\");\n        }\n        this.scopeId = scopeId;\n        return this;\n    }\n\n    @Override\n    public BatchPartBuilder 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 BatchPartBuilder scopeType(String scopeType) {\n        if (scopeType == null) {\n            throw new FlowableIllegalArgumentException(\"scopeType is null\");\n        }\n        this.scopeType = scopeType;\n        return this;\n    }\n\n    @Override\n    public BatchPart create() {\n        if (batch == null) {\n            throw new FlowableIllegalArgumentException(\"batch has to be provided\");\n        }\n\n        if (type == null) {\n            throw new FlowableIllegalArgumentException(\"type has to be provided\");\n        }\n        if (commandExecutor != null) {\n            return commandExecutor.execute(commandContext -> createSafe());\n        } else {\n            return createSafe();","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-batch-service/src/main/java/org/flowable/batch/service/BatchPartBuilderImpl.java#L83-L119","documentation":"BatchPartBuilderImpl.scopeType(String) throws FlowableIllegalArgumentException when scopeType is null. The scope type (e.g. bpmn, cmmn) tells the batch service which engine scope the part belongs to and is a mandatory field.","triggerScenarios":"Calling .scopeType(null) on a BatchPartBuilder, usually when the scope type is derived from a variable or configuration that is unset.","commonSituations":"Generic batch handlers that operate across engines and fail to map the current context to a scope type string; misconfigured batch job definitions.","solutions":["Pass the correct ScopeTypes constant (e.g. ScopeTypes.BPMN or ScopeTypes.CMMN) to scopeType(...)","Derive the scope type from the engine context with a guaranteed non-null fallback or explicit error earlier in the flow","Validate batch job configuration at startup so scopeType is never missing at runtime"],"exampleFix":"// before\nbuilder.scopeType(scopeType); // may be null\n// after\nbuilder.scopeType(scopeType != null ? scopeType : ScopeTypes.BPMN);","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(scopeType, \"scopeType must not be null\");\nif (!ScopeTypes.BPMN.equals(scopeType) && !ScopeTypes.CMMN.equals(scopeType)) {\n    throw new IllegalArgumentException(\"Unknown scopeType: \" + scopeType);\n}\nbuilder.scopeType(scopeType);","typeGuard":"boolean isValidScopeType = ScopeTypes.BPMN.equals(scopeType) || ScopeTypes.CMMN.equals(scopeType);","tryCatchPattern":"try {\n    builder.scopeType(scopeType);\n} catch (FlowableIllegalArgumentException e) {\n    throw new IllegalArgumentException(\"scopeType not resolved from engine context\", e);\n}","preventionTips":["Derive scopeType from org.flowable.engine.impl.util.CommandContextUtil or ScopeTypes constants, not free text","Validate batch job config (scopeType) at startup","Map each engine context to exactly one scope type in a central helper"],"tags":["null-argument","batch","flowable"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}