{"record":{"id":"1b1f2f74801ffdc9","repo":"flowable/flowable-engine","slug":"process-instance-id-list-is-null-1b1f2f","errorCode":null,"errorMessage":"Process instance id list is null","messagePattern":"Process instance id list is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":162,"sourceCode":"                    .getHistoricTaskInstanceEntityManager()\n                    .findHistoricTaskInstancesByQueryCriteria(this);\n        }\n    }\n\n    @Override\n    public HistoricTaskInstanceQueryImpl processInstanceId(String processInstanceId) {\n        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","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/HistoricTaskInstanceQueryImpl.java#L144-L180","documentation":"HistoricTaskInstanceQueryImpl.processInstanceIdIn(List<String>) validates the list of process instance ids before building the query: it must be non-null and non-empty, and (as the surrounding code shows) no element may be null. The null-list case throws ActivitiIllegalArgumentException with 'Process instance id list is null'.","triggerScenarios":"Calling processInstanceIdIn(null) — usually a list that failed to load, an unguarded Optional.map chain, or a mapped request body missing the field.","commonSituations":"Job orchestrators forwarding id lists produced by an earlier step that returned nothing; REST payloads with an absent/incorrectly-named field deserialized to null; cache lookups that return null instead of an empty list.","solutions":["Initialize the list before calling, e.g. new ArrayList<>(ids).","Guard the call: only apply the filter when the list is non-null and non-empty; otherwise skip it or short-circuit the search.","Null-check every element too, since individual null ids are also rejected.","Fix the producer that returns null lists so it returns empty collections instead."],"exampleFix":"// before\nList<String> ids = (List<String>) cache.get(\"pids\"); // null\nquery.processInstanceIdIn(ids);\n// after\nList<String> ids = (List<String>) cache.get(\"pids\");\nif (ids != null && !ids.isEmpty()) {\n    query.processInstanceIdIn(ids);\n} else {\n    return Collections.emptyList();\n}","handlingStrategy":"validation","validationCode":"if (processInstanceIds == null || processInstanceIds.isEmpty()) {\n    return Collections.emptyList(); // or skip the filter\n}\nif (processInstanceIds.contains(null)) {\n    throw new IllegalArgumentException(\"null element in processInstanceIds\");\n}","typeGuard":"boolean isUsableIdList(java.util.List<String> l) {\n    return l != null && !l.isEmpty() && l.stream().allMatch(java.util.Objects::nonNull);\n}","tryCatchPattern":"try {\n    query.processInstanceIdIn(ids);\n} catch (ActivitiIllegalArgumentException e) {\n    if (e.getMessage().contains(\"id list is null\")) {\n        // treat as missing input: skip filter or fail with a domain error\n    }\n}","preventionTips":["Guard producer methods to return empty lists, not null.","Validate list and elements before applying IN filters.","Short-circuit empty searches instead of issuing a doomed query.","Null-check deserialized request bodies at the boundary."],"tags":["java","activiti","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"}