{"record":{"id":"69c83276e8ada31f","repo":"flowable/flowable-engine","slug":"searchkey-is-null","errorCode":null,"errorMessage":"searchKey is null","messagePattern":"searchKey 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":94,"sourceCode":"            throw new FlowableIllegalArgumentException(\"batchId is null\");\n        }\n        this.batchId = batchId;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery type(String type) {\n        if (type == null) {\n            throw new FlowableIllegalArgumentException(\"type is null\");\n        }\n        this.type = type;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery searchKey(String searchKey) {\n        if (searchKey == null) {\n            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\");","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java#L76-L112","documentation":"BatchPartQueryImpl.searchKey(String) filters batch parts by the batch search key. Passing null throws FlowableIllegalArgumentException immediately, as the library treats null as an invalid filter value rather than 'no filter'. Thrown at the searchKey(...) call site.","triggerScenarios":"Calling BatchPartQuery.searchKey(null), usually when the search key comes from a nullable variable, optional user input, or a lookup that returned nothing.","commonSituations":"Search forms where the key field was left empty; batch created without a searchKey so downstream lookups pass null; null return from a helper resolving the search key.","solutions":["Null-check the search key before applying the filter.","Build the query conditionally, omitting searchKey(...) when the value is absent.","Ensure batches that will be queried by search key are created with a non-null searchKey."],"exampleFix":"// before\nBatchPartQuery q = batchService.createBatchPartQuery().searchKey(key);\n// after\nBatchPartQuery q = batchService.createBatchPartQuery();\nif (key != null) {\n    q.searchKey(key);\n}","handlingStrategy":"validation","validationCode":"BatchPartQuery query = batchService.createBatchPartQuery();\nif (searchKey != null) {\n    query.searchKey(searchKey);\n}\nList<BatchPart> parts = query.list();","typeGuard":"boolean hasSearchKey(String k) {\n    return k != null && !k.isEmpty();\n}","tryCatchPattern":"try {\n    List<BatchPart> parts = query.searchKey(searchKey).list();\n} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {\n    throw new IllegalArgumentException(\"searchKey must not be null when filtering batch parts\", e);\n}","preventionTips":["Only create batches with a searchKey if you plan to query by it.","Null-guard optional search criteria before query building."],"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"}