{"record":{"id":"61cdf08891881d5e","repo":"flowable/flowable-engine","slug":"set-of-taskids-is-empty-61cdf0","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-engine/src/main/java/org/flowable/engine/impl/cmd/GetTasksLocalVariablesCmd.java","lineNumber":47,"sourceCode":"/**\n * @author Daisuke Yoshimoto\n */\npublic class GetTasksLocalVariablesCmd implements Command<List<VariableInstance>>, Serializable {\n\n    private static final long serialVersionUID = 1L;\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        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        List<VariableInstanceEntity> entities = processEngineConfiguration.getVariableServiceConfiguration().getVariableService()\n                .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":29,"sourceCodeEnd":63,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTasksLocalVariablesCmd.java#L29-L63","documentation":"GetTasksLocalVariablesCmd throws FlowableIllegalArgumentException(\"Set of taskIds is empty\") when the supplied task id collection is non-null but has no elements. An empty IN-clause query is meaningless and would either fail in SQL or return misleading results, so the engine rejects it eagerly.","triggerScenarios":"taskService.getTasksLocalVariables(Collections.emptySet()) or passing an id collection that was filtered down to zero items (e.g. all tasks already completed) before the batch variable fetch.","commonSituations":"Bulk UI pages loading variables for a task list that happens to be empty; filtering by criteria that matched nothing; passing a freshly created but unpopulated collection.","solutions":["Check !taskIds.isEmpty() before calling the batch API and skip the call when empty.","Return an empty variable map/result directly for an empty id set instead of querying.","Fix the filtering logic that unexpectedly reduces the id set to zero if a non-empty set was expected.","Catch FlowableIllegalArgumentException as a client-side validation failure."],"exampleFix":"// before\nList<VariableInstance> vars = taskService.getTasksLocalVariables(taskIds);\n// after\nMap<String, List<VariableInstance>> varsByTask = taskIds.isEmpty()\n    ? Collections.emptyMap()\n    : groupVariables(taskService.getTasksLocalVariables(taskIds));","handlingStrategy":"validation","validationCode":"if (taskIds == null || taskIds.isEmpty()) {\n    return Collections.emptyMap(); // skip the query entirely\n}","typeGuard":"boolean isNonEmpty(Collection<String> ids) { return ids != null && !ids.isEmpty(); }","tryCatchPattern":"try {\n    return taskService.getTasksLocalVariables(taskIds);\n} catch (FlowableIllegalArgumentException e) {\n    return Collections.emptyList();\n}","preventionTips":["Short-circuit batch queries on empty inputs — return empty results instead","Check upstream filters that can legitimately reduce the id set to zero","Wrap batch APIs in helpers that normalize null/empty inputs"],"tags":["flowable","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"}