{"record":{"id":"31b7c85db8d300d6","repo":"flowable/flowable-engine","slug":"none-of-the-given-process-instance-ids-can-be-null","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":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":308,"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(Collection<String> processInstanceIds) {\n        if (processInstanceIds == null) {\n            throw new FlowableIllegalArgumentException(\"Process instance id list is null\");\n        }\n        if (processInstanceIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Process instance id list is empty\");\n        }\n        for (String processInstanceId : processInstanceIds) {\n            if (processInstanceId == null) {\n                throw new FlowableIllegalArgumentException(\"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 withoutProcessInstanceId() {\n        if (inOrStatement) {\n            currentOrQueryObject.withoutProcessInstanceId = true;\n        } else {\n            this.withoutProcessInstanceId = true;\n        }","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java#L290-L326","documentation":"HistoricTaskInstanceQueryImpl.processInstanceIdIn(Collection<String>) iterates the collection and throws FlowableIllegalArgumentException('None of the given process instance ids can be null') if any individual element is null, since a null id inside the IN clause is invalid. It validates each element after checking the list itself for null and emptiness.","triggerScenarios":"Passing a Collection<String> that contains null elements (e.g. a List built with null placeholders, a map-values view containing nulls) to processInstanceIdIn.","commonSituations":"Ids gathered from optional lookups where missing values were stored as null; deserialized JSON arrays containing nulls; lists pre-allocated to a fixed size with unfilled slots.","solutions":["Filter out nulls before calling: ids.removeIf(Objects::isNull) or stream().filter(Objects::nonNull).","Fix the producer so missing ids are omitted rather than added as null.","Optionally re-check after filtering that the list is still non-empty before applying the predicate."],"exampleFix":"// before\nquery.processInstanceIdIn(rawIds); // contains null -> exception\n\n// after\nList<String> ids = rawIds.stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (!ids.isEmpty()) {\n    query.processInstanceIdIn(ids);\n}","handlingStrategy":"validation","validationCode":"List<String> ids = rawIds == null ? Collections.emptyList() : rawIds.stream().filter(Objects::nonNull).collect(Collectors.toList());","typeGuard":"boolean hasNoNulls(Collection<String> c) { return c != null && c.stream().allMatch(Objects::nonNull); }","tryCatchPattern":null,"preventionTips":["Filter nulls at collection build time (Objects::nonNull)","Avoid fixed-size pre-allocated lists with unfilled slots","Reject null ids at API boundaries where ids are collected"],"tags":["query","null-argument","collection","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-18T11:17:12.947Z"}