{"record":{"id":"796f534c0d6c2b6c","repo":"flowable/flowable-engine","slug":"set-of-case-instance-ids-is-null-796f53","errorCode":null,"errorMessage":"Set of case instance ids is null","messagePattern":"Set of case instance 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/PlanItemInstanceQueryImpl.java","lineNumber":163,"sourceCode":"    }\n\n    @Override\n    public PlanItemInstanceQuery caseInstanceId(String caseInstanceId) {\n        if (caseInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"Case instance id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseInstanceId = caseInstanceId;\n        } else {\n            this.caseInstanceId = caseInstanceId;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery caseInstanceIds(Set<String> caseInstanceIds) {\n        if (caseInstanceIds == null) {\n            throw new FlowableIllegalArgumentException(\"Set of case instance ids is null\");\n        }\n        if (caseInstanceIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Set of case instance ids is empty\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseInstanceIds = caseInstanceIds;\n        } else {\n            this.caseInstanceIds = caseInstanceIds;\n        }\n        return this;\n    }\n\n    @Override\n    public PlanItemInstanceQuery stageInstanceId(String stageInstanceId) {\n        if (stageInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"Stage instance id is null\");\n        }","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/PlanItemInstanceQueryImpl.java#L145-L181","documentation":"Flowable's PlanItemInstanceQuery.caseInstanceIds(Set<String>) throws FlowableIllegalArgumentException when the set itself is null. The batch variant expects a populated collection of case instance ids; passing null is rejected immediately at query-build time. An empty set is also rejected (separately) because it would produce invalid SQL IN clauses.","triggerScenarios":"Calling caseInstanceIds(null) — typically when the Set was declared but never initialized, or a method returning a set of ids returned null on some code path.","commonSituations":"Bulk dashboard/reporting code assembling ids from another query whose result was null; refactoring from single-id to batch filtering without initializing the collection; deserialization of an empty request body yielding a null field.","solutions":["Initialize and populate the Set with case instance ids before passing it","Guard the call: only invoke caseInstanceIds(ids) when ids != null (and not empty)","If there are no ids, skip the filter or short-circuit the query entirely rather than passing null"],"exampleFix":"// before\nSet<String> ids = getCaseIds(); // may return null\nquery.caseInstanceIds(ids);\n\n// after\nSet<String> ids = getCaseIds();\nif (ids != null && !ids.isEmpty()) {\n    query.caseInstanceIds(ids);\n}","handlingStrategy":"validation","validationCode":"if (caseInstanceIds != null && !caseInstanceIds.isEmpty()) {\n    query.caseInstanceIds(caseInstanceIds);\n}","typeGuard":"boolean isNonEmpty(Set<String> s) { return s != null && !s.isEmpty(); }","tryCatchPattern":"try {\n    query.caseInstanceIds(caseInstanceIds);\n} catch (FlowableIllegalArgumentException e) {\n    return Collections.emptyList(); // treat null/empty set as no matches\n}","preventionTips":["Initialize collections eagerly; avoid returning null sets from helper methods (return Collections.emptySet())","Treat empty id sets as 'no results' and short-circuit before building the query","Add unit tests for null/empty collection paths in query-building code"],"tags":["flowable","cmmn","query","null-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"}