{"record":{"id":"9e19aa0bfb68a157","repo":"flowable/flowable-engine","slug":"case-instance-ids-is-null-9e19aa","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/runtime/CaseInstanceQueryImpl.java","lineNumber":320,"sourceCode":"\n    @Override\n    public CaseInstanceQueryImpl caseInstanceId(String caseInstanceId) {\n        if (caseInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"Case instance id is null\");\n        }\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 CaseInstanceQueryImpl caseInstanceIds(Set<String> caseInstanceIds) {\n        if (caseInstanceIds == null) {\n            throw new FlowableIllegalArgumentException(\"Case instance ids is null\");\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 CaseInstanceQuery caseInstanceName(String name) {\n        if (name == null) {\n            throw new FlowableIllegalArgumentException(\"Name is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.name = name;\n        } else {","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L302-L338","documentation":"Flowable throws FlowableIllegalArgumentException from CaseInstanceQueryImpl.caseInstanceIds(Set<String>) when the id set is null. The set itself must be a non-null object (an empty set is allowed and simply matches nothing useful); null is rejected eagerly during query construction. Internal callers such as migrateCaseInstancesOfCaseDefinition rely on this to catch empty migration inputs early.","triggerScenarios":"Calling createCaseInstanceQuery().caseInstanceIds(null), or migration APIs (migrateCaseInstancesOfCaseDefinition / batchMigrateCaseInstancesOfCaseDefinition) passing through a null instance-id collection collected from an empty/failed prior lookup.","commonSituations":"Batch operations where the ids collection was never initialized; result of a previous query returned null instead of an empty set; refactors changing a List to a Set without initializing it.","solutions":["Initialize the set (Collections.emptySet() / new HashSet<>()) instead of leaving it null, or skip the criterion call when null","In migration code, guard: if (instanceIds == null || instanceIds.isEmpty()) return early before building the query","Ensure prior lookups return empty collections, never null","Catch FlowableIllegalArgumentException in batch entry points and report which input was null"],"exampleFix":"// before\nSet<String> ids = collectInstanceIds(); // may return null\nquery.caseInstanceIds(ids);\n// after\nSet<String> ids = collectInstanceIds();\nif (ids != null && !ids.isEmpty()) {\n    query.caseInstanceIds(ids);\n}","handlingStrategy":"validation","validationCode":"if (ids == null || ids.isEmpty()) { return; } query.caseInstanceIds(ids);","typeGuard":"boolean hasIds = ids != null && !ids.isEmpty();","tryCatchPattern":"try { query.caseInstanceIds(instanceIds); } catch (FlowableIllegalArgumentException e) { log.warn(\"Null instance id set for migration\"); return Collections.emptyList(); }","preventionTips":["Have collection-returning helpers return empty collections, never null","Initialize Set fields at declaration (new HashSet<>())","In batch/migration entry points, early-return on null/empty input collections"],"tags":["flowable","cmmn","query","null-argument","migration"],"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"}