{"record":{"id":"a42262fa592d39a1","repo":"flowable/flowable-engine","slug":"ids-is-an-empty-collection","errorCode":null,"errorMessage":"ids is an empty collection","messagePattern":"ids is an empty collection","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDefinitionQueryImpl.java","lineNumber":142,"sourceCode":"        this.nameLike = nameLike;\n        return this;\n    }\n\n    @Override\n    public AppDefinitionQueryImpl deploymentId(String deploymentId) {\n        if (deploymentId == null) {\n            throw new FlowableIllegalArgumentException(\"id is null\");\n        }\n        this.deploymentId = deploymentId;\n        return this;\n    }\n\n    @Override\n    public AppDefinitionQueryImpl deploymentIds(Set<String> deploymentIds) {\n        if (deploymentIds == null) {\n            throw new FlowableIllegalArgumentException(\"ids are null\");\n        } else if (deploymentIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"ids is an empty collection\");\n        }\n        this.deploymentIds = deploymentIds;\n        return this;\n    }\n\n    @Override\n    public AppDefinitionQueryImpl appDefinitionKey(String key) {\n        if (key == null) {\n            throw new FlowableIllegalArgumentException(\"key is null\");\n        }\n        this.key = key;\n        return this;\n    }\n\n    @Override\n    public AppDefinitionQueryImpl appDefinitionKeyLike(String keyLike) {\n        if (keyLike == null) {\n            throw new FlowableIllegalArgumentException(\"keyLike is null\");","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDefinitionQueryImpl.java#L124-L160","documentation":"deploymentIds(Set<String>) throws 'ids is an empty collection' when a non-null but empty set is passed. An empty IN clause is invalid SQL, so Flowable rejects it eagerly instead of producing a query that matches nothing unexpectedly.","triggerScenarios":"Calling appDefinitionQuery.deploymentIds(new HashSet<>()) or any Set that ended up empty — e.g. an upstream filter removed all ids, a split of an empty string, or collection-initialization without population.","commonSituations":"Batch job with no ids selected; search UI submitted with zero selections; ids parsed from a blank config value producing an empty list converted to a set.","solutions":["Skip the deploymentIds filter entirely when the set is empty (an empty filter usually means 'no constraint')","Return early / short-circuit the query when no ids are requested","Decide explicitly whether empty means 'match all' (omit filter) or 'match none' (return empty result without querying)"],"exampleFix":"// before\nquery.deploymentIds(deploymentIds); // throws when empty\n// after\nif (deploymentIds != null && !deploymentIds.isEmpty()) {\n    query.deploymentIds(deploymentIds);\n}","handlingStrategy":"validation","validationCode":"if (deploymentIds == null || deploymentIds.isEmpty()) {\n    return Collections.emptyList(); // or omit the filter, per semantics\n}\nquery.deploymentIds(deploymentIds);","typeGuard":"boolean isNonEmpty(Set<String> s) { return s != null && !s.isEmpty(); }","tryCatchPattern":"try {\n    query.deploymentIds(deploymentIds);\n} catch (FlowableIllegalArgumentException e) {\n    throw new ResponseStatusException(HttpStatus.BAD_REQUEST, e.getMessage(), e);\n}","preventionTips":["Decide explicitly: empty set means 'no constraint' (skip filter) or 'no matches' (short-circuit)","Never issue queries with empty IN-clauses; validate collection size first","Guard collected/filtered id sets before passing them on"],"tags":["flowable","empty-collection","query-builder","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"}