{"record":{"id":"4320ab3a2ca68b2e","repo":"flowable/flowable-engine","slug":"taskids-is-null","errorCode":null,"errorMessage":"taskIds is null","messagePattern":"taskIds is null","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":45,"sourceCode":"import org.flowable.variable.service.impl.persistence.entity.VariableInstanceEntity;\n\n/**\n * @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}","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetTasksLocalVariablesCmd.java#L27-L63","documentation":"GetTasksLocalVariablesCmd.execute() bulk-fetches local variable instances for a set of task ids. It rejects a null taskIds collection with FlowableIllegalArgumentException('taskIds is null') because the query cannot be built without an id set.","triggerScenarios":"Calling cmmnTaskService.getVariableInstancesLocalByTaskIds(null) (or the corresponding bulk task-variables API); executing a directly constructed GetTasksLocalVariablesCmd(null).","commonSituations":"Caller built the id set conditionally and never initialized it; upstream query returned null instead of an empty list; integration glue that forwards a nullable collection parameter.","solutions":["Initialize taskIds to an empty Set/List instead of null before calling the bulk API.","Null-check the collection parameter at the call site.","Fix the upstream producer of the id collection to return an empty collection rather than null."],"exampleFix":"// before\nList<VariableInstance> vars = cmmnTaskService.getVariableInstancesLocalByTaskIds(taskIds);\n// after\nSet<String> ids = (taskIds != null) ? taskIds : Collections.emptySet();\nif (!ids.isEmpty()) {\n    List<VariableInstance> vars = cmmnTaskService.getVariableInstancesLocalByTaskIds(ids);\n}","handlingStrategy":"validation","validationCode":"if (taskIds == null) { throw new IllegalArgumentException(\"taskIds collection must be initialized\"); }","typeGuard":"boolean hasTaskIds(Collection<String> taskIds) { return taskIds != null; }","tryCatchPattern":"try { return taskService.getVariableInstancesLocalByTaskIds(taskIds); } catch (FlowableIllegalArgumentException e) { return Collections.emptyList(); }","preventionTips":["Initialize collections eagerly (Collections.emptySet()) instead of leaving null","Have upstream producers return empty collections, never null","Cover bulk APIs with unit tests for null/empty inputs"],"tags":["flowable","cmmn","null-argument","bulk-query"],"backgroundTag":"null-argument","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"}