{"record":{"id":"a3a68e23a022d887","repo":"flowable/flowable-engine","slug":"case-instance-ids-is-null","errorCode":null,"errorMessage":"Case instance ids is null","messagePattern":"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/history/HistoricCaseInstanceQueryImpl.java","lineNumber":327,"sourceCode":"    }\n\n    @Override\n    public HistoricCaseInstanceQueryImpl 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 HistoricCaseInstanceQueryImpl caseInstanceIds(Set<String> caseInstanceIds) {\n        if (caseInstanceIds == null) {\n            throw new FlowableIllegalArgumentException(\"Case instance ids is null\");\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 HistoricCaseInstanceQueryImpl caseInstanceName(String name) {\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseInstanceName = name;\n        } else {\n            this.caseInstanceName = name;\n        }\n        return this;\n    }","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/history/HistoricCaseInstanceQueryImpl.java#L309-L345","documentation":"Fluent-query guard in HistoricCaseInstanceQueryImpl.caseInstanceIds: the set of case instance ids used as an IN filter is null; the builder rejects it rather than generating an IN () clause or a NULL comparison.","triggerScenarios":"Calling caseInstanceIds(null), typically because an upstream collection was never instantiated or a lookup returned null instead of an empty set.","commonSituations":"Collecting ids from a previous query result that was null; deserializing JSON where the ids array is missing.","solutions":["Pass a non-null Set, e.g. Collections.emptySet() when there are no ids.","Initialize the set at declaration so it is never null.","Catch FlowableIllegalArgumentException and return a validation error."],"exampleFix":"// before\nquery.caseInstanceIds(idsMap.get(\"ids\")); // null when key missing\n// after\nSet<String> ids = idsMap.getOrDefault(\"ids\", Collections.emptySet());\nquery.caseInstanceIds(ids);","handlingStrategy":"validation","validationCode":"if (caseInstanceIds == null) { throw new IllegalArgumentException(\"caseInstanceIds must not be null\"); }\nhistoricCaseInstanceQuery.caseInstanceIds(caseInstanceIds);","typeGuard":"boolean isValidIdSet(Set<String> ids) { return ids != null; }","tryCatchPattern":"try {\n    query.caseInstanceIds(ids);\n} catch (FlowableIllegalArgumentException e) {\n    throw new BadRequestException(\"caseInstanceIds must not be null\", e);\n}","preventionTips":["Initialize collections at declaration (avoid null collections)","Use Collections.emptySet() instead of null for 'no values'","Normalize upstream query results to empty collections","Null-check sets at API boundaries"],"tags":["java","flowable","cmmn","null-argument","query-validation"],"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"}