{"record":{"id":"3692114c9390a852","repo":"flowable/flowable-engine","slug":"subscopeid-is-null","errorCode":null,"errorMessage":"subScopeId is null","messagePattern":"subScopeId 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":92,"sourceCode":"            throw new FlowableIllegalArgumentException(\"status is null\");\n        }\n        this.status = status;\n        return this;\n    }\n\n    @Override\n    public BatchPartBuilder scopeId(String scopeId) {\n        if (scopeId == null) {\n            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\");","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-batch-service/src/main/java/org/flowable/batch/service/BatchPartBuilderImpl.java#L74-L110","documentation":"BatchPartBuilderImpl.subScopeId(String) throws FlowableIllegalArgumentException when subScopeId is null. The sub-scope id identifies the sub-element (e.g. a specific job or plan item) within the scope and is required by the builder.","triggerScenarios":"Calling .subScopeId(null) on a BatchPartBuilder, e.g. when the sub-element id comes from an optional association that was not set.","commonSituations":"Timer/job handlers building batch parts where the job id is missing; modeling errors leaving a scope without its sub-scope element.","solutions":["Provide the sub-scope element's id (e.g. job id) before building the batch part","Only call subScopeId(...) after verifying the referenced sub-element exists","If your use case has no sub-scope, check whether an alternate builder/API without that requirement exists"],"exampleFix":"// before\nbuilder.subScopeId(jobId); // jobId may be null\n// after\nif (jobId != null) {\n    builder.subScopeId(jobId);\n} else {\n    throw new IllegalStateException(\"Job not resolved; cannot create batch part\");\n}","handlingStrategy":"validation","validationCode":"Objects.requireNonNull(subScopeId, \"subScopeId must be provided\");\nbuilder.subScopeId(subScopeId);","typeGuard":"boolean hasSubScope = subScopeId instanceof String s && !s.isEmpty();","tryCatchPattern":"try {\n    builder.subScopeId(subScopeId);\n} catch (FlowableIllegalArgumentException e) {\n    throw new IllegalStateException(\"Sub-scope element missing for batch part\", e);\n}","preventionTips":["Check that the referenced sub-element (job/plan item) exists before building","Treat missing sub-scope ids as data errors and surface them early","Use typed lookups (managementService.findJob by id) that fail loudly"],"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"}