{"record":{"id":"2a01e7f64885bfb7","repo":"flowable/flowable-engine","slug":"case-definition-keys-is-null-2a01e7","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/runtime/CaseInstanceQueryImpl.java","lineNumber":503,"sourceCode":"    }\n    \n    @Override\n    public CaseInstanceQueryImpl 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 CaseInstanceQueryImpl 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 CaseInstanceQueryImpl 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":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L485-L521","documentation":"Flowable's CaseInstanceQueryImpl throws FlowableIllegalArgumentException when caseDefinitionKeys(Set<String>) is called with a null set. Unlike some sibling methods, this check rejects only null (an empty set is accepted), filtering case instances by their case definition key (the 'key' attribute of the CMMN case model). Pass a non-null set of definition keys.","triggerScenarios":"Calling caseDefinitionKeys(null); passing a set field from configuration/DTO that was never populated; collecting definition keys from a repository lookup that returned null instead of an empty set.","commonSituations":"Multi-tenant deployments where the allowed case definition keys come from tenant config that is missing; refactoring from caseDefinitionKey (single) to caseDefinitionKeys (plural) with an uninitialized collection; Spring bean wiring where the Set property has no default.","solutions":["Initialize the set before calling (Collections.emptySet() is acceptable here; only null is rejected)","Only add the criterion when the set reference is non-null","Fix the configuration/lookup that should have supplied the definition keys","Use caseDefinitionKey(String) if you only have a single key"],"exampleFix":"// before\nquery.caseDefinitionKeys(allowedKeys); // allowedKeys may be null\n// after\nif (allowedKeys != null) {\n    query.caseDefinitionKeys(allowedKeys);\n}","handlingStrategy":"validation","validationCode":"if (caseDefinitionKeys == null) {\n    return query; // null is rejected; empty set is allowed\n}\nquery.caseDefinitionKeys(caseDefinitionKeys);","typeGuard":"boolean hasCaseDefinitionKeys(Set<String> keys) {\n    return keys != null;\n}","tryCatchPattern":"try {\n    query.caseDefinitionKeys(caseDefinitionKeys);\n} catch (FlowableIllegalArgumentException e) {\n    log.warn(\"Null case definition keys: {}\", e.getMessage());\n    throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"caseDefinitionKeys must not be null\");\n}","preventionTips":["Initialize Set fields with Collections.emptySet() rather than leaving them null","Note the difference from sibling methods: only null is rejected here, empty sets pass","Provide defaults for configuration-driven definition key sets","Use caseDefinitionKey(String) when a single key is available"],"tags":["flowable","cmmn","query","null-check","case-definition"],"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"}