{"record":{"id":"3b4c6a8fe6bfe4f2","repo":"flowable/flowable-engine","slug":"none-of-the-given-process-instance-ids-can-be-null-3b4c6a","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":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java","lineNumber":745,"sourceCode":"        if (orActive) {\n            currentOrQueryObject.processInstanceId = processInstanceId;\n        } else {\n            this.processInstanceId = processInstanceId;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQuery 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 (orActive) {\n            currentOrQueryObject.processInstanceIds = processInstanceIds;\n        } else {\n            this.processInstanceIds = processInstanceIds;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl withoutProcessInstanceId() {\n        if (orActive) {\n            currentOrQueryObject.withoutProcessInstanceId = true;\n        } else {\n            this.withoutProcessInstanceId = true;\n        }","sourceCodeStart":727,"sourceCodeEnd":763,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L727-L763","documentation":"TaskQueryImpl.processInstanceIdIn() iterates the collection and rejects any null element, since a null id in the IN list would produce an invalid or always-false SQL predicate. The library throws FlowableIllegalArgumentException naming the offending condition.","triggerScenarios":"Calling .processInstanceIdIn(list) where the list contains null entries, e.g. from Arrays.asList(a, b) with a null, or from a Map lookup keyed by absent ids.","commonSituations":"Collecting ids into a size-padded array; streaming results where some rows lack a process instance id.","solutions":["Filter nulls before the call: ids.removeIf(Objects::isNull) or ids.stream().filter(Objects::nonNull).collect(toList())","Fix the producer to never emit null ids","If filtering empties the list, also handle the empty-collection case first"],"exampleFix":"// before\nquery.processInstanceIdIn(ids); // may contain nulls\n// after\nList<String> clean = ids.stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (clean.isEmpty()) { return Collections.emptyList(); }\nquery.processInstanceIdIn(clean);","handlingStrategy":"validation","validationCode":"List<String> clean = processInstanceIds == null\n    ? Collections.emptyList()\n    : processInstanceIds.stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (clean.isEmpty()) { return Collections.emptyList(); }\nquery.processInstanceIdIn(clean);","typeGuard":"boolean hasNoNullIds(Collection<String> c) { return c != null && c.stream().allMatch(Objects::nonNull); }","tryCatchPattern":"try {\n    tasks = taskService.createTaskQuery().processInstanceIdIn(ids).list();\n} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {\n    log.warn(\"Null element in id list: {}\", e.getMessage());\n    tasks = Collections.emptyList();\n}","preventionTips":["Always .filter(Objects::nonNull) before building IN-clause queries","Avoid Arrays.asList with possibly-null members; build lists with streams","Fix producers that emit null ids (e.g. Map.get on absent keys)"],"tags":["flowable","task-query","null-argument","collection"],"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"}