{"record":{"id":"405579e155b25b97","repo":"flowable/flowable-engine","slug":"case-definition-key-is-null-405579","errorCode":null,"errorMessage":"Case definition key is null","messagePattern":"Case definition key 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":170,"sourceCode":"\n    @Override\n    public CaseInstanceQueryImpl caseDefinitionIds(Set<String> caseDefinitionIds) {\n        if (caseDefinitionIds == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition ids is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionIds = caseDefinitionIds;\n        } else {\n            this.caseDefinitionIds = caseDefinitionIds;\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQueryImpl caseDefinitionKey(String caseDefinitionKey) {\n        if (caseDefinitionKey == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition key is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionKey = caseDefinitionKey;\n        } else {\n            this.caseDefinitionKey = caseDefinitionKey;\n        }\n        return this;\n    }\n    \n    @Override\n    public CaseInstanceQueryImpl caseDefinitionKeyLike(String caseDefinitionKeyLike) {\n        if (caseDefinitionKeyLike == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition key is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionKeyLike = caseDefinitionKeyLike;\n        } else {\n            this.caseDefinitionKeyLike = caseDefinitionKeyLike;","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L152-L188","documentation":"CaseInstanceQueryImpl.caseDefinitionKey filters case instances by the case definition's key and validates the argument, throwing FlowableIllegalArgumentException when null. Null is rejected rather than treated as 'no filter' to catch accidental API misuse.","triggerScenarios":"createCaseInstanceQuery().caseDefinitionKey(null), e.g. when the key is read from config/request and is absent.","commonSituations":"Filter forms where the definition key dropdown has no default value; refactored code that removed the literal key but kept the call.","solutions":["Pass the actual case definition key string.","Call caseDefinitionKey only when the key is non-null.","Validate the input at the boundary before building the query."],"exampleFix":"// before\nquery.caseDefinitionKey(params.getKey()).list();\n// after\nif (params.getKey() != null) {\n    query = query.caseDefinitionKey(params.getKey());\n}\nquery.list();","handlingStrategy":"validation","validationCode":"if (caseDefinitionKey != null) {\n    query = query.caseDefinitionKey(caseDefinitionKey);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat every query filter setter as requiring a non-null argument.","Validate search inputs before constructing Flowable queries.","Prefer Optional<String> in your own layer to make 'absent' explicit."],"tags":["null-argument","query","cmmn","illegal-argument"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}