{"record":{"id":"00d4900a95657989","repo":"flowable/flowable-engine","slug":"none-of-the-given-process-instance-ids-can-be-null-00d490","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":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java","lineNumber":627,"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(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 (orActive) {\n            currentOrQueryObject.processInstanceIds = processInstanceIds;\n        } else {\n            this.processInstanceIds = processInstanceIds;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl processInstanceBusinessKey(String processInstanceBusinessKey) {\n        if (orActive) {\n            currentOrQueryObject.processInstanceBusinessKey = processInstanceBusinessKey;\n        } else {\n            this.processInstanceBusinessKey = processInstanceBusinessKey;\n        }","sourceCodeStart":609,"sourceCodeEnd":645,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/TaskQueryImpl.java#L609-L645","documentation":"TaskQueryImpl.processInstanceIdIn(List<String>) iterates the given ids and throws ActivitiIllegalArgumentException if any individual element is null. The engine builds a SQL IN clause from the list, and a null element cannot be bound as a valid process instance id.","triggerScenarios":"Calling taskQuery.processInstanceIdIn(Arrays.asList(\"id1\", null)) or passing a collection produced by a mapping step that inserted nulls (e.g. Map lookups that missed, or a results array with placeholder nulls).","commonSituations":"Joining ids from external systems where some lookups failed and nulls were kept instead of dropped; deserializing JSON arrays that contain null entries.","solutions":["Filter out null (and blank) ids before passing the list: ids.removeIf(Objects::isNull) or build a new filtered list.","Validate each id is non-null/non-blank at the boundary where the list is created and fail with a precise message about which entry is bad.","Catch ActivitiIllegalArgumentException around query construction and report the invalid id list to the caller."],"exampleFix":"// before\ntaskQuery.processInstanceIdIn(ids); // ids may contain nulls\n\n// after\nList<String> cleanIds = ids.stream()\n    .filter(Objects::nonNull)\n    .collect(Collectors.toList());\nif (!cleanIds.isEmpty()) {\n    taskQuery.processInstanceIdIn(cleanIds);\n}","handlingStrategy":"validation","validationCode":"List<String> cleanIds = ids == null ? Collections.emptyList()\n    : ids.stream().filter(Objects::nonNull).collect(Collectors.toList());\nif (!cleanIds.isEmpty()) {\n    taskQuery.processInstanceIdIn(cleanIds);\n}","typeGuard":"boolean hasNoNullEntries(List<String> ids) { return ids != null && ids.stream().allMatch(Objects::nonNull); }","tryCatchPattern":"try {\n    return taskQuery.processInstanceIdIn(ids).list();\n} catch (ActivitiIllegalArgumentException e) {\n    log.warn(\"Null entry in process instance ids: {}\", e.getMessage());\n    throw new BadRequestException(\"All process instance ids must be non-null\");\n}","preventionTips":["Drop nulls (and blanks) when collecting ids from Map lookups or joins","Validate list contents, not just the list itself","Reject null entries at the deserialization boundary"],"tags":["activiti","flowable","task-query","argument-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"}