{"record":{"id":"267c8674f945b5e1","repo":"flowable/flowable-engine","slug":"none-of-the-given-process-instance-ids-can-be-null-267c86","errorCode":null,"errorMessage":"None of the given process instance ids can be null","messagePattern":"None of the given process instance ids can be null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":169,"sourceCode":"        if (inOrStatement) {\n            this.currentOrQueryObject.processInstanceId = processInstanceId;\n        } else {\n            this.processInstanceId = processInstanceId;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQueryImpl processInstanceIdIn(List<String> processInstanceIds) {\n        if (processInstanceIds == null) {\n            throw new ActivitiIllegalArgumentException(\"Process instance id list is null\");\n        }\n        if (processInstanceIds.isEmpty()) {\n            throw new ActivitiIllegalArgumentException(\"Process instance id list is empty\");\n        }\n        for (String processInstanceId : processInstanceIds) {\n            if (processInstanceId == null) {\n                throw new ActivitiIllegalArgumentException(\"None of the given process instance ids can be null\");\n            }\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 HistoricTaskInstanceQueryImpl processInstanceBusinessKey(String processInstanceBusinessKey) {\n        if (inOrStatement) {\n            this.currentOrQueryObject.processInstanceBusinessKey = processInstanceBusinessKey;\n        } else {\n            this.processInstanceBusinessKey = processInstanceBusinessKey;\n        }","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java#L151-L187","documentation":"HistoricTaskInstanceQueryImpl.processInstanceIdIn() throws ActivitiIllegalArgumentException when any element of the supplied process instance id list is null. The list is rendered into an SQL IN clause, where null elements are not permitted. Remove null entries or fix the code producing them.","triggerScenarios":"Calling historicTaskInstanceQuery.processInstanceIdIn(Arrays.asList(\"id1\", null)) or any List<String> containing a null element.","commonSituations":"Collecting ids from a map/dataset with missing keys; deserializing a JSON array containing nulls; list built from optional lookups that returned null instead of skipping.","solutions":["Filter nulls out of the list before calling: ids.removeIf(Objects::isNull).","Fix the upstream source that inserts null ids into the collection.","Use Objects.requireNonNull on each id at collection time to fail fast at the source."],"exampleFix":"// before\nquery.processInstanceIdIn(ids); // ids contains nulls\n\n// after\nList<String> cleanIds = ids.stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (!cleanIds.isEmpty()) {\n    query.processInstanceIdIn(cleanIds);\n}","handlingStrategy":"validation","validationCode":"List<String> clean = ids == null ? Collections.emptyList() : ids.stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (clean.isEmpty()) { throw new IllegalArgumentException(\"need at least one non-null process instance id\"); }","typeGuard":"static boolean hasNoNulls(List<String> list) { return list != null && list.stream().allMatch(Objects::nonNull); }","tryCatchPattern":"try {\n    query.processInstanceIdIn(ids);\n} catch (org.activiti.engine.ActivitiIllegalArgumentException e) {\n    throw new IllegalArgumentException(\"Bad process instance id list: \" + e.getMessage(), e);\n}","preventionTips":["Filter nulls at the point where the id list is assembled, not at query time.","Avoid Map.get-based id collection returning nulls; use getOrDefault or filter.","Enable deserialization strictness so JSON nulls in id arrays are rejected early."],"tags":["java","activiti","query-validation","null-element"],"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"}