{"record":{"id":"adac4a1184acd385","repo":"flowable/flowable-engine","slug":"set-of-process-instance-ids-is-null-adac4a","errorCode":null,"errorMessage":"Set of process instance ids is null","messagePattern":"Set of process instance ids is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/ProcessInstanceQueryImpl.java","lineNumber":162,"sourceCode":"    }\n\n    @Override\n    public ProcessInstanceQueryImpl processInstanceId(String processInstanceId) {\n        if (processInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"Process instance id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.executionId = processInstanceId;\n        } else {\n            this.executionId = processInstanceId;\n        }\n        return this;\n    }\n\n    @Override\n    public ProcessInstanceQuery processInstanceIds(Set<String> processInstanceIds) {\n        if (processInstanceIds == null) {\n            throw new FlowableIllegalArgumentException(\"Set of process instance ids is null\");\n        }\n        if (processInstanceIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Set of process instance ids is empty\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.processInstanceIds = processInstanceIds;\n        } else {\n            this.processInstanceIds = processInstanceIds;\n        }\n        return this;\n    }\n\n    @Override\n    public ProcessInstanceQuery processInstanceBusinessKey(String businessKey) {\n        if (businessKey == null) {\n            throw new FlowableIllegalArgumentException(\"Business key is null\");\n        }","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/ProcessInstanceQueryImpl.java#L144-L180","documentation":"processInstanceIds(Set<String>) filters by a set of process instance ids. Flowable throws FlowableIllegalArgumentException when the set is null; callers must provide an actual Set. Used directly by the process-definition migration helpers, which construct this query to select instances to migrate.","triggerScenarios":"Calling processInstanceIds(null) directly, or via migrateProcessInstancesOfProcessDefinition / batchMigrateProcessInstancesOfProcessDefinition / validateMigrateProcessInstancesOfProcessDefinition when the instance-id list resolved to null.","commonSituations":"Migration tooling where the id list comes from a payload/file that failed to load; deserialization yielding null instead of an empty set; passing a List where a Set is expected via untyped APIs.","solutions":["Pass a non-null Set of instance ids (may be validated non-empty before the call).","Initialize the collection to an empty Set at declaration so it's never null.","In migration flows, collect the ids first and abort with a clear message if none were loaded."],"exampleFix":"// before\nSet<String> ids = loadIds(); // may return null\nmigrationBuilder.migrateProcessInstancesOfProcessDefinition(defId, q -> q.processInstanceIds(ids));\n\n// after\nSet<String> ids = loadIds();\nif (ids == null || ids.isEmpty()) {\n    throw new IllegalStateException(\"no process instance ids supplied for migration\");\n}\nmigrationBuilder.migrateProcessInstancesOfProcessDefinition(defId, q -> q.processInstanceIds(ids));","handlingStrategy":"validation","validationCode":"if (ids == null) { throw new IllegalArgumentException(\"process instance ids set must not be null\"); }","typeGuard":null,"tryCatchPattern":"try { query.processInstanceIds(ids); } catch (FlowableIllegalArgumentException e) { throw new BadRequestException(\"processInstanceIds must be a non-null, non-empty set\"); }","preventionTips":["Initialize id collections to empty Sets, never leave them null.","Validate loaded/collected id sets before passing them to migration builders.","Use Objects.requireNonNullElse(ids, Set.of()) only when empty-set semantics are acceptable downstream."],"tags":["java","flowable","query-builder","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"}