{"record":{"id":"6bb23e942861b85c","repo":"flowable/flowable-engine","slug":"process-instance-id-list-is-null-6bb23e","errorCode":null,"errorMessage":"Process instance id list is null","messagePattern":"Process instance id list is 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":738,"sourceCode":"            this.withoutTenantId = true;\n        }\n        return this;\n    }\n\n    @Override\n    public TaskQueryImpl processInstanceId(String processInstanceId) {\n        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","sourceCodeStart":720,"sourceCodeEnd":756,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L720-L756","documentation":"TaskQueryImpl.processInstanceIdIn() requires a non-null collection of process instance ids to build the IN clause. A null collection cannot be translated to SQL, so the library throws FlowableIllegalArgumentException immediately.","triggerScenarios":"Calling taskService.createTaskQuery().processInstanceIdIn(null), often when the collection comes from an upstream method that returned null instead of an empty list.","commonSituations":"Aggregating ids from a previous query that returned null; deserializing request payloads where the ids field is absent.","solutions":["Pass a non-null collection, e.g. List.of(\"pi-1\",\"pi-2\")","Null-check the collection and skip the query or use an empty-result shortcut when absent","Fix the upstream producer to return an empty list rather than null"],"exampleFix":"// before\nList<String> ids = fetchProcessInstanceIds(); // may return null\nquery.processInstanceIdIn(ids);\n// after\nList<String> ids = fetchProcessInstanceIds();\nif (ids != null && !ids.isEmpty()) {\n    query.processInstanceIdIn(ids);\n} else {\n    return Collections.emptyList();\n}","handlingStrategy":"validation","validationCode":"if (processInstanceIds == null) {\n    throw new IllegalArgumentException(\"processInstanceIds must not be null\");\n}\nquery.processInstanceIdIn(processInstanceIds);","typeGuard":"boolean isQueryableIdList(Collection<String> c) { return c != null && !c.isEmpty() && 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(\"Invalid id list for query: {}\", e.getMessage());\n    tasks = Collections.emptyList();\n}","preventionTips":["Never return null collections from producers; return empty lists","Use Collections.emptyList()/List.of() literals instead of null defaults","Validate collections at API boundaries (REST DTOs with @NotNull)"],"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"}