{"record":{"id":"d96826b8ec292394","repo":"flowable/flowable-engine","slug":"set-of-case-instance-ids-is-null","errorCode":null,"errorMessage":"Set of case instance ids is null","messagePattern":"Set of case instance ids is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricPlanItemInstanceQueryImpl.java","lineNumber":182,"sourceCode":"            this.derivedCaseDefinitionId = derivedCaseDefinitionId;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricPlanItemInstanceQuery planItemInstanceCaseInstanceId(String caseInstanceId) {\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseInstanceId = caseInstanceId;\n        } else {\n            this.caseInstanceId = caseInstanceId;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricPlanItemInstanceQuery planItemInstanceCaseInstanceIds(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        if (inOrStatement) {\n            this.currentOrQueryObject.caseInstanceIds = caseInstanceIds;\n        } else {\n            this.caseInstanceIds = caseInstanceIds;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricPlanItemInstanceQuery planItemInstanceStageInstanceId(String stageInstanceId) {\n        if (inOrStatement) {\n            this.currentOrQueryObject.stageInstanceId = stageInstanceId;\n        } else {\n            this.stageInstanceId = stageInstanceId;","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricPlanItemInstanceQueryImpl.java#L164-L200","documentation":"HistoricPlanItemInstanceQueryImpl.planItemInstanceCaseInstanceIds() requires a non-null Set of case instance ids; a null set raises FlowableIllegalArgumentException. The query API distinguishes null (programming error) from not calling the method (no filter).","triggerScenarios":"Calling planItemInstanceCaseInstanceIds(null), often from a map lookup or variable initialized to null instead of an empty/collection value.","commonSituations":"Passing the result of a cache/config lookup that returned null; framework deserializers producing null for absent list parameters.","solutions":["Null-check the set before calling and skip the filter when null","Initialize the collection to an empty Set and only call the method when non-empty","Ensure the upstream code path that should populate the set actually runs","Use planItemInstanceCaseInstanceId for a single id instead of a set"],"exampleFix":"// before\nquery.planItemInstanceCaseInstanceIds(ids).list();\n// after\nif (ids != null && !ids.isEmpty()) {\n    query.planItemInstanceCaseInstanceIds(ids);\n}\nList<HistoricPlanItemInstance> results = query.list();","handlingStrategy":"validation","validationCode":"if (ids != null && !ids.isEmpty()) {\n    query.planItemInstanceCaseInstanceIds(ids);\n}","typeGuard":"boolean isUsableIdSet(Set<String> s) { return s != null && !s.isEmpty(); }","tryCatchPattern":"try {\n    query.planItemInstanceCaseInstanceIds(ids);\n} catch (FlowableIllegalArgumentException e) {\n    if (!e.getMessage().contains(\"Set of case instance ids is null\")) throw e;\n    // fall back to unfiltered query or return empty result\n}","preventionTips":["Initialize id collections eagerly; never leave them null","Only call collection-filter methods when the collection is non-null and non-empty","Validate collections at the boundary before building queries"],"tags":["flowable","cmmn","query-api","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-14T16:17:12.679Z"}