{"record":{"id":"5fee485b5f9d4934","repo":"flowable/flowable-engine","slug":"batchtype-is-null","errorCode":null,"errorMessage":"batchType is null","messagePattern":"batchType is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java","lineNumber":112,"sourceCode":"            throw new FlowableIllegalArgumentException(\"searchKey is null\");\n        }\n        this.searchKey = searchKey;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery searchKey2(String searchKey2) {\n        if (searchKey2 == null) {\n            throw new FlowableIllegalArgumentException(\"searchKey2 is null\");\n        }\n        this.searchKey2 = searchKey2;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery batchType(String batchType) {\n        if (batchType == null) {\n            throw new FlowableIllegalArgumentException(\"batchType is null\");\n        }\n        this.batchType = batchType;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery batchSearchKey(String searchKey) {\n        if (searchKey == null) {\n            throw new FlowableIllegalArgumentException(\"batchSearchKey is null\");\n        }\n        this.batchSearchKey = searchKey;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery batchSearchKey2(String searchKey2) {\n        if (searchKey2 == null) {\n            throw new FlowableIllegalArgumentException(\"batchSearchKey2 is null\");","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java#L94-L130","documentation":"BatchPartQueryImpl.batchType(String) filters batch parts by the type of their parent batch. A null argument throws FlowableIllegalArgumentException immediately — the library refuses null filters. Thrown at the batchType(...) call before query execution.","triggerScenarios":"Calling BatchPartQuery.batchType(null), usually when the batch type is read from configuration, a BatchType-derived string, or a nullable request parameter.","commonSituations":"Missing config entry for the batch type; enum-to-string conversion returning null; clients omitting the batch type parameter.","solutions":["Null-check the batch type before calling batchType(...).","Apply the filter conditionally when the type is optional.","Verify the configuration/enum providing the batch type yields a non-null value."],"exampleFix":"// before\nBatchPartQuery q = batchService.createBatchPartQuery().batchType(batchType);\n// after\nBatchPartQuery q = batchService.createBatchPartQuery();\nif (batchType != null) {\n    q.batchType(batchType);\n}","handlingStrategy":"validation","validationCode":"BatchPartQuery query = batchService.createBatchPartQuery();\nif (batchType != null) {\n    query.batchType(batchType);\n}\nList<BatchPart> parts = query.list();","typeGuard":"boolean hasBatchType(String t) {\n    return t != null && !t.isEmpty();\n}","tryCatchPattern":"try {\n    List<BatchPart> parts = query.batchType(batchType).list();\n} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {\n    throw new IllegalArgumentException(\"batchType must not be null when filtering batch parts\", e);\n}","preventionTips":["Resolve batch types from a single non-null constants/config source.","Null-check configuration-derived filter values before passing them to queries."],"tags":["flowable","batch","query","null-check"],"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"}