{"record":{"id":"e2ec1f0d8ef98d8c","repo":"flowable/flowable-engine","slug":"set-of-taskids-is-empty","errorCode":null,"errorMessage":"Set of taskIds is empty","messagePattern":"Set of taskIds is empty","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetTasksLocalVariablesCmd.java","lineNumber":48,"sourceCode":" * @author Tijs Rademakers\n */\npublic class GetTasksLocalVariablesCmd implements Command<List<VariableInstance>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    \n    protected Set<String> taskIds;\n\n    public GetTasksLocalVariablesCmd(Set<String> taskIds) {\n        this.taskIds = taskIds;\n    }\n\n    @Override\n    public List<VariableInstance> execute(CommandContext commandContext) {\n        if (taskIds == null) {\n            throw new FlowableIllegalArgumentException(\"taskIds is null\");\n        }\n        if (taskIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Set of taskIds is empty\");\n        }\n\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        List<VariableInstanceEntity> entities = cmmnEngineConfiguration.getVariableServiceConfiguration()\n                .getVariableService().createInternalVariableInstanceQuery().taskIds(taskIds).list();\n        List<VariableInstance> instances = new ArrayList<>(entities.size());\n        for (VariableInstanceEntity entity : entities) {\n            entity.getValue();\n            instances.add(entity);\n        }\n\n        return instances;\n    }\n\n}\n","sourceCodeStart":30,"sourceCodeEnd":64,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetTasksLocalVariablesCmd.java#L30-L64","documentation":"After rejecting a null collection, GetTasksLocalVariablesCmd also rejects an empty one: taskIds.isEmpty() triggers FlowableIllegalArgumentException('Set of taskIds is empty'). The engine refuses to issue a query with an empty IN clause, which would be invalid or would return nothing useful.","triggerScenarios":"Calling the bulk local-variables API with an empty Set/Collection of task ids, e.g. after filtering out all candidate tasks.","commonSituations":"A preceding task query matched nothing, so the id set is empty; filters removed every id before the bulk fetch; loop where the first batch legitimately has no tasks.","solutions":["Guard with !taskIds.isEmpty() before calling the bulk API and return an empty result instead.","Check why the upstream task query produced no ids if an empty set is unexpected.","Skip the variable fetch entirely when the id set is empty - there is nothing to fetch."],"exampleFix":"// before\nList<VariableInstance> vars = cmmnTaskService.getVariableInstancesLocalByTaskIds(taskIds);\n// after\nList<VariableInstance> vars = (taskIds == null || taskIds.isEmpty())\n        ? Collections.emptyList()\n        : cmmnTaskService.getVariableInstancesLocalByTaskIds(taskIds);","handlingStrategy":"validation","validationCode":"if (taskIds == null || taskIds.isEmpty()) { return Collections.emptyList(); }","typeGuard":"boolean isFetchable(Collection<String> taskIds) { return taskIds != null && !taskIds.isEmpty(); }","tryCatchPattern":"try { return taskService.getVariableInstancesLocalByTaskIds(taskIds); } catch (FlowableIllegalArgumentException e) { return Collections.emptyList(); }","preventionTips":["Short-circuit bulk queries when the id set is empty","Investigate empty upstream results instead of blindly forwarding","Wrap bulk fetches in a helper that normalizes null/empty to empty results"],"tags":["flowable","cmmn","empty-collection","bulk-query"],"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-14T11:17:12.474Z"}