{"record":{"id":"1eb9d7d321d1a7c8","repo":"flowable/flowable-engine","slug":"process-instance-id-list-is-empty-1eb9d7","errorCode":null,"errorMessage":"Process instance id list is empty","messagePattern":"Process instance id list is empty","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java","lineNumber":741,"sourceCode":"    }\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\n    @Override\n    public TaskQueryImpl withoutProcessInstanceId() {\n        if (orActive) {","sourceCodeStart":723,"sourceCodeEnd":759,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/TaskQueryImpl.java#L723-L759","documentation":"TaskQueryImpl.processInstanceIdIn() rejects an empty collection because an empty SQL IN () is invalid and would silently match nothing. The library throws FlowableIllegalArgumentException so the caller handles the empty case explicitly.","triggerScenarios":"Calling .processInstanceIdIn(Collections.emptyList()) or passing a collection filtered down to zero elements at runtime.","commonSituations":"Chaining queries where an earlier result set was empty; batch jobs with no work items in the current window.","solutions":["Check collection.isEmpty() before calling and return an empty result list early","Or omit the processInstanceIdIn filter if an empty set should mean 'no constraint' (verify business semantics)","For pagination-style IN queries, chunk and skip empty chunks"],"exampleFix":"// before\nquery.processInstanceIdIn(ids); // ids can be empty\n// after\nif (ids.isEmpty()) {\n    return Collections.emptyList();\n}\nquery.processInstanceIdIn(ids);","handlingStrategy":"validation","validationCode":"if (processInstanceIds == null || processInstanceIds.isEmpty()) {\n    return Collections.emptyList(); // nothing to query\n}\nquery.processInstanceIdIn(processInstanceIds);","typeGuard":"boolean nonEmpty(Collection<?> c) { return c != null && !c.isEmpty(); }","tryCatchPattern":"try {\n    tasks = taskService.createTaskQuery().processInstanceIdIn(ids).list();\n} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {\n    log.warn(\"Empty/null id list: {}\", e.getMessage());\n    tasks = Collections.emptyList();\n}","preventionTips":["Short-circuit queries built from empty upstream result sets","Chunk large id lists (e.g. Oracle 1000-item IN limit) and skip empty chunks","Document that empty means 'no results', not 'no filter' in your service layer"],"tags":["flowable","task-query","empty-collection","validation"],"backgroundTag":"empty-required-field","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"}