{"record":{"id":"7f1dc73f25cb636c","repo":"flowable/flowable-engine","slug":"set-of-process-definition-ids-is-empty","errorCode":null,"errorMessage":"Set of process definition ids is empty","messagePattern":"Set of process definition ids is empty","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/ProcessInstanceQueryImpl.java","lineNumber":423,"sourceCode":"        if (processDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"Process definition id is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.processDefinitionId = processDefinitionId;\n        } else {\n            this.processDefinitionId = processDefinitionId;\n        }\n        return this;\n    }\n\n    @Override\n    public ProcessInstanceQuery processDefinitionIds(Set<String> processDefinitionIds) {\n        if (processDefinitionIds == null) {\n            throw new FlowableIllegalArgumentException(\"Set of process definition ids is null\");\n        }\n        if (processDefinitionIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Set of process definition ids is empty\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.processDefinitionIds = processDefinitionIds;\n        } else {\n            this.processDefinitionIds = processDefinitionIds;\n        }\n        return this;\n    }\n\n    @Override\n    public ProcessInstanceQueryImpl processDefinitionKey(String processDefinitionKey) {\n        if (processDefinitionKey == null) {\n            throw new FlowableIllegalArgumentException(\"Process definition key is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.processDefinitionKey = processDefinitionKey;","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/ProcessInstanceQueryImpl.java#L405-L441","documentation":"ProcessInstanceQueryImpl.processDefinitionIds(Set<String>) throws FlowableIllegalArgumentException('Set of process definition ids is empty') when the supplied set is non-null but has no elements. An empty set would produce an invalid or always-false IN() clause, so Flowable rejects it explicitly right after the null check, before storing the value on the query or OR-query object.","triggerScenarios":"Calling .processDefinitionIds(Collections.emptySet()) or passing a set that was filtered down to zero elements (e.g. no definitions match the user's permissions, or ids were removed before the call).","commonSituations":"Multi-tenant apps where a user belongs to no tenant and the permitted-definition set ends up empty; batch jobs whose filter criteria matched nothing; tests passing an empty set expecting 'no filter' semantics.","solutions":["Check isEmpty() before calling and skip the filter (or return an empty result immediately) when the set is empty","Decide explicitly: an empty set should usually mean 'return nothing' — short-circuit with query.listPage(0,0) or an impossible filter instead","Investigate why the id set is empty (permission/tenant logic) if that state is unexpected","Catch FlowableIllegalArgumentException around query construction to give a precise message"],"exampleFix":"// before\nSet<String> ids = resolvePermittedDefinitionIds(user);\nquery.processDefinitionIds(ids); // throws when user has no permissions\n\n// after\nSet<String> ids = resolvePermittedDefinitionIds(user);\nif (ids == null || ids.isEmpty()) {\n    return Collections.emptyList(); // no permitted definitions -> no results\n}\nquery.processDefinitionIds(ids);","handlingStrategy":"validation","validationCode":"if (ids == null || ids.isEmpty()) {\n    return Collections.emptyList(); // nothing can match an empty IN clause\n}\nquery.processDefinitionIds(ids);","typeGuard":"boolean hasIds(Set<String> ids) { return ids != null && !ids.isEmpty(); }","tryCatchPattern":"try {\n    query.processDefinitionIds(ids);\n} catch (FlowableIllegalArgumentException e) {\n    return Collections.emptyList(); // empty set = no matches by convention\n}","preventionTips":["Decide the semantics of an empty id set (no results) and short-circuit before querying","Check isEmpty() alongside null whenever passing collections to IN-style filters","Investigate unexpected empty sets from permission/tenant resolution logic","Add tests where filters reduce the id set to zero elements"],"tags":["flowable","query-validation","empty-collection","in-clause"],"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"}