{"record":{"id":"d40124b083bf77f9","repo":"flowable/flowable-engine","slug":"case-definition-keys-is-null","errorCode":null,"errorMessage":"Case definition keys is null","messagePattern":"Case definition keys 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":500,"sourceCode":"    }\n    \n    @Override\n    public HistoricCaseInstanceQueryImpl caseInstanceBusinessStatusLikeIgnoreCase(String businessStatusLikeIgnoreCase) {\n        if (businessStatusLikeIgnoreCase == null) {\n            throw new FlowableIllegalArgumentException(\"Business status is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.businessStatusLikeIgnoreCase = businessStatusLikeIgnoreCase;\n        } else {\n            this.businessStatusLikeIgnoreCase = businessStatusLikeIgnoreCase;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricCaseInstanceQueryImpl caseDefinitionKeys(Set<String> caseDefinitionKeys) {\n        if (caseDefinitionKeys == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition keys is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionKeys = caseDefinitionKeys;\n        } else {\n            this.caseDefinitionKeys = caseDefinitionKeys;\n        }\n        return this;\n    }\n    \n    @Override\n    public HistoricCaseInstanceQueryImpl excludeCaseDefinitionKeys(Set<String> excludeCaseDefinitionKeys) {\n        if (excludeCaseDefinitionKeys == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition keys is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.excludeCaseDefinitionKeys = excludeCaseDefinitionKeys;\n        } else {\n            this.excludeCaseDefinitionKeys = excludeCaseDefinitionKeys;","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java#L482-L518","documentation":"HistoricCaseInstanceQueryImpl.caseDefinitionKeys() throws FlowableIllegalArgumentException when the Set of case definition keys is null. The keys are used to build an SQL IN filter, so null is rejected before assignment (to the query or, in an or() block, to currentOrQueryObject). Note this check only tests null — an empty set is accepted here, unlike parentScopeIds.","triggerScenarios":"Calling caseDefinitionKeys(null), e.g. when the keys collection comes from an Optional, a JSON body field, or another query's result that produced no value.","commonSituations":"Multi-tenant dashboards filtering historic cases by a set of case definition keys loaded from configuration; a missing config section yields null and is passed straight through.","solutions":["Pass a Set containing at least the desired case definition keys, e.g. Set.of(\"loanCase\").","Skip the call when the key set is null to apply no definition-key filter.","Coalesce null to an empty Set only if you additionally check isEmpty() before calling.","Catch FlowableIllegalArgumentException around query assembly for user-supplied filters."],"exampleFix":"// before\nquery.caseDefinitionKeys(definitionKeys);\n// after\nif (definitionKeys != null && !definitionKeys.isEmpty()) {\n    query.caseDefinitionKeys(definitionKeys);\n}","handlingStrategy":"validation","validationCode":"if (caseDefinitionKeys != null && !caseDefinitionKeys.isEmpty()) {\n    query.caseDefinitionKeys(caseDefinitionKeys);\n}","typeGuard":"boolean hasKeys(Set<String> keys) {\n    return keys != null && !keys.isEmpty();\n}","tryCatchPattern":"try {\n    query.caseDefinitionKeys(keys);\n} catch (FlowableIllegalArgumentException e) {\n    throw new InvalidRequestException(\"caseDefinitionKeys must not be null\");\n}","preventionTips":["Initialize key sets to empty collections rather than null","Load definition-key configuration defensively with defaults","Apply set-based filters only when the set has elements","Assert configuration completeness at application startup"],"tags":["flowable","cmmn","query","null-argument","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"}