{"record":{"id":"d1d82c01bb903eac","repo":"flowable/flowable-engine","slug":"set-of-executionids-is-empty-d1d82c","errorCode":null,"errorMessage":"Set of executionIds is empty","messagePattern":"Set of executionIds is empty","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetExecutionsVariablesCmd.java","lineNumber":45,"sourceCode":" * @author Daisuke Yoshimoto\n */\npublic class GetExecutionsVariablesCmd implements Command<List<VariableInstance>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected Set<String> executionIds;\n\n    public GetExecutionsVariablesCmd(Set<String> executionIds) {\n        this.executionIds = executionIds;\n    }\n\n    @Override\n    public List<VariableInstance> execute(CommandContext commandContext) {\n        // Verify existence of executions\n        if (executionIds == null) {\n            throw new ActivitiIllegalArgumentException(\"executionIds is null\");\n        }\n        if (executionIds.isEmpty()) {\n            throw new ActivitiIllegalArgumentException(\"Set of executionIds is empty\");\n        }\n\n        List<VariableInstance> instances = new ArrayList<>();\n        List<VariableInstanceEntity> entities = commandContext.getVariableInstanceEntityManager().findVariableInstancesByExecutionIds(executionIds);\n        for (VariableInstanceEntity entity : entities) {\n            entity.getValue();\n            instances.add(entity);\n        }\n        return instances;\n    }\n\n}\n","sourceCodeStart":27,"sourceCodeEnd":58,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/cmd/GetExecutionsVariablesCmd.java#L27-L58","documentation":"After the null check, GetExecutionsVariablesCmd.execute() rejects an empty executionIds set with ActivitiIllegalArgumentException('Set of executionIds is empty'). A batch variable query with no ids would return nothing meaningful and likely produces an invalid SQL IN clause, so the engine fails fast.","triggerScenarios":"Calling RuntimeService.getVariableInstancesByExecutionIds(Collections.emptySet()) or with a set that was drained/filtered to zero elements; executing the command directly with an empty collection.","commonSituations":"Filtering removed all candidate executions, a query for active executions returned none, or refactoring changed the population logic so nothing is added to the set.","solutions":["Guard with executionIds.isEmpty() on the caller side and return an empty result without hitting the engine.","Only call the batch API when you have at least one id; fall back to the single-execution API otherwise.","Investigate why the id-collection step produced an empty set (upstream query/filters)."],"exampleFix":"// before\nList<VariableInstance> vars = runtimeService.getVariableInstancesByExecutionIds(ids);\n// after\nList<VariableInstance> vars = ids == null || ids.isEmpty()\n    ? Collections.emptyList()\n    : runtimeService.getVariableInstancesByExecutionIds(ids);","handlingStrategy":"validation","validationCode":"if (executionIds == null || executionIds.isEmpty()) {\n    return Collections.emptyList(); // skip the batch query entirely\n}","typeGuard":"boolean isNonEmpty(Collection<String> c) { return c != null && !c.isEmpty(); }","tryCatchPattern":"try {\n    return runtimeService.getVariableInstancesByExecutionIds(executionIds);\n} catch (ActivitiIllegalArgumentException e) {\n    if (e.getMessage().contains(\"is empty\")) { return Collections.emptyList(); }\n    throw e;\n}","preventionTips":["Short-circuit empty batches before calling the engine.","Log when filters remove all candidate executions so it's not silent.","Prefer Set<String> initialized from the source query results to avoid nulls/empties."],"tags":["empty-collection","batch-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-18T11:17:12.947Z"}