{"record":{"id":"67c4ef4c5a23b100","repo":"flowable/flowable-engine","slug":"case-definition-ids-is-null-67c4ef","errorCode":null,"errorMessage":"Case definition ids is null","messagePattern":"Case definition ids 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":156,"sourceCode":"\n    @Override\n    public CaseInstanceQueryImpl caseDefinitionId(String caseDefinitionId) {\n        if (caseDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition id is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionId = caseDefinitionId;\n        } else {\n            this.caseDefinitionId = caseDefinitionId;\n        }\n        return this;\n    }\n\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 {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L138-L174","documentation":"CaseInstanceQueryImpl.caseDefinitionIds accepts a Set of case definition ids to filter on and rejects a null set with FlowableIllegalArgumentException. The query API distinguishes 'no filter' (don't call the method) from an explicit null argument, which is treated as a programming error.","triggerScenarios":"createCaseInstanceQuery().caseDefinitionIds(null), typically when the set comes from an optional input that was never populated. populateFromQuery callers propagate the same null through populateQuery.","commonSituations":"Multi-select definition filter in a UI where the user selected nothing and the collection is null instead of empty; deserialized request body omitting the ids field.","solutions":["Pass a non-null Set (an empty set if nothing is selected, though verify desired semantics).","Only call caseDefinitionIds when the collection is non-null and non-empty.","Normalize null collections from request DTOs to null-safe conditional calls."],"exampleFix":"// before\nquery.caseDefinitionIds(selectedIds).list();\n// after\nif (selectedIds != null && !selectedIds.isEmpty()) {\n    query = query.caseDefinitionIds(selectedIds);\n}\nquery.list();","handlingStrategy":"validation","validationCode":"if (caseDefinitionIds != null && !caseDefinitionIds.isEmpty()) {\n    query = query.caseDefinitionIds(caseDefinitionIds);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Initialize id collections to empty sets instead of null in DTOs.","Guard all collection-based query filters with null/empty checks.","Add a shared query-builder utility to enforce this pattern project-wide."],"tags":["null-argument","query","cmmn","collection"],"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"}