{"record":{"id":"5eb0ad67351ac0ac","repo":"flowable/flowable-engine","slug":"set-of-process-instance-ids-is-empty-5eb0ad","errorCode":null,"errorMessage":"Set of process instance ids is empty","messagePattern":"Set of process instance ids is empty","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/ExecutionQueryImpl.java","lineNumber":315,"sourceCode":"    public ExecutionQueryImpl processInstanceId(String processInstanceId) {\n        if (processInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"Process instance id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.processInstanceId = processInstanceId;\n        } else {\n            this.processInstanceId = processInstanceId;\n        }\n        return this;\n    }\n\n    @Override\n    public ExecutionQuery processInstanceIds(Set<String> processInstanceIds) {\n        if (processInstanceIds == null) {\n            throw new FlowableIllegalArgumentException(\"Set of process instance ids is null\");\n        }\n        if (processInstanceIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Set of process instance ids is empty\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.processInstanceIds = processInstanceIds;\n        } else {\n            this.processInstanceIds = processInstanceIds;\n        }\n        return this;\n    }\n\n    @Override\n    public ExecutionQueryImpl rootProcessInstanceId(String rootProcessInstanceId) {\n        if (rootProcessInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"Root process instance id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.rootProcessInstanceId = rootProcessInstanceId;\n        } else {","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/ExecutionQueryImpl.java#L297-L333","documentation":"ExecutionQueryImpl.processInstanceIds(Set<String>) also rejects an empty set with FlowableIllegalArgumentException(\"Set of process instance ids is empty\"), because an IN () clause with no values is invalid SQL. The library forces callers to make an explicit decision when there is nothing to query.","triggerScenarios":"Calling processInstanceIds with a set that was created but never populated, or filtered down to zero elements before the query runs.","commonSituations":"Building ids from a prior search whose results were empty; filtering by tenant/permission removed all candidates; batch job with no work items for this run.","solutions":["Guard with ids.isEmpty() before building the query and return an empty result early","Fall back to a different query (e.g. by processDefinitionKey) when no ids are known","Skip executing the query entirely in that code path","Catch FlowableIllegalArgumentException and treat it as 'no results' if acceptable"],"exampleFix":"// before\nExecution execution = runtimeService.createExecutionQuery().processInstanceIds(ids).singleResult();\n// after\nif (ids == null || ids.isEmpty()) {\n    return Collections.emptyList();\n}\nList<Execution> executions = runtimeService.createExecutionQuery().processInstanceIds(ids).list();","handlingStrategy":"validation","validationCode":"if (ids == null || ids.isEmpty()) {\n    return Collections.emptyList();\n}","typeGuard":"boolean isNonEmptyIdSet(Set<String> ids) {\n    return ids != null && !ids.isEmpty();\n}","tryCatchPattern":"try {\n    return query.processInstanceIds(ids).list();\n} catch (FlowableIllegalArgumentException e) {\n    return Collections.emptyList();\n}","preventionTips":["Short-circuit to an empty result when the id set is empty","Never issue an IN-query with zero values — it is rejected by design","Log when an empty candidate set silently skips a query so callers can detect it"],"tags":["flowable","empty-collection","query","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-14T05:17:10.506Z"}