{"record":{"id":"38089b950823ba99","repo":"flowable/flowable-engine","slug":"business-key-is-null","errorCode":null,"errorMessage":"Business key is null","messagePattern":"Business key is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java","lineNumber":370,"sourceCode":"            this.caseInstanceNameLike = nameLike;\n        }\n        return this;\n    }\n    \n    @Override\n    public HistoricCaseInstanceQueryImpl caseInstanceNameLikeIgnoreCase(String nameLikeIgnoreCase) {\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseInstanceNameLikeIgnoreCase = nameLikeIgnoreCase;\n        } else {\n            this.caseInstanceNameLikeIgnoreCase = nameLikeIgnoreCase;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricCaseInstanceQueryImpl caseInstanceBusinessKey(String businessKey) {\n        if (businessKey == null) {\n            throw new FlowableIllegalArgumentException(\"Business key is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.businessKey = businessKey;\n        } else {\n            this.businessKey = businessKey;\n        }\n        return this;\n    }\n    \n    @Override\n    public HistoricCaseInstanceQueryImpl caseInstanceBusinessKeyLike(String businessKeyLike) {\n        if (businessKeyLike == null) {\n            throw new FlowableIllegalArgumentException(\"Business key is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.businessKeyLike = businessKeyLike;\n        } else {\n            this.businessKeyLike = businessKeyLike;","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java#L352-L388","documentation":"caseInstanceBusinessKey(String) throws FlowableIllegalArgumentException('Business key is null') when the business key argument is null. Business keys are optional query filters, so callers should simply skip the setter rather than pass null.","triggerScenarios":"Calling caseInstanceBusinessKey(null) with a business key sourced from an optional request parameter, header, or external record field.","commonSituations":"Search endpoints where businessKey is an optional filter; integration code copying fields from payloads with missing keys.","solutions":["Only call caseInstanceBusinessKey when a non-null business key exists.","Substitute a like-query or skip filtering entirely if no key is available.","Catch FlowableIllegalArgumentException and map it to a 400 response."],"exampleFix":"// before\nquery.caseInstanceBusinessKey(payload.get(\"businessKey\"));\n// after\nString businessKey = payload.get(\"businessKey\");\nif (businessKey != null) {\n    query.caseInstanceBusinessKey(businessKey);\n}","handlingStrategy":"validation","validationCode":"if (businessKey == null) { throw new IllegalArgumentException(\"businessKey must not be null\"); }\nhistoricCaseInstanceQuery.caseInstanceBusinessKey(businessKey);","typeGuard":"boolean hasBusinessKey(String key) { return key != null && !key.isEmpty(); }","tryCatchPattern":"try {\n    query.caseInstanceBusinessKey(businessKey);\n} catch (FlowableIllegalArgumentException e) {\n    throw new BadRequestException(\"businessKey must not be null\", e);\n}","preventionTips":["Treat business key as an optional filter: only set it when present","Trim/validate business key input before querying","Document that Flowable query setters reject nulls","Centralize filter-building logic in one guarded helper"],"tags":["java","flowable","cmmn","null-argument","query-validation"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}