{"record":{"id":"5dc2cd69b83107ac","repo":"flowable/flowable-engine","slug":"taskid-is-null-5dc2cd","errorCode":null,"errorMessage":"taskId is null","messagePattern":"taskId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ActivateTaskCmd.java","lineNumber":45,"sourceCode":"import org.flowable.task.service.HistoricTaskService;\nimport org.flowable.task.service.impl.persistence.entity.TaskEntity;\n\npublic class ActivateTaskCmd implements Command<Void> {\n\n    protected String taskId;\n    protected String userId;\n\n    public ActivateTaskCmd(String taskId, String userId) {\n        this.taskId = taskId;\n        this.userId = userId;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        \n        if (taskId == null) {\n            throw new FlowableIllegalArgumentException(\"taskId is null\");\n        }\n\n        TaskEntity task = processEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);\n\n        if (task == null) {\n            throw new FlowableObjectNotFoundException(\"Cannot find task with id \" + taskId, Task.class);\n        }\n\n        if (task.isDeleted()) {\n            throw new FlowableException(task + \" is already deleted\");\n        }\n\n        if (!task.isSuspended()) {\n            throw new FlowableException(task + \" is not suspended, so can't be activated\");\n        }\n        \n        Clock clock = processEngineConfiguration.getClock();\n        Date updateTime = clock.getCurrentTime();","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ActivateTaskCmd.java#L27-L63","documentation":"FlowableIllegalArgumentException thrown by ActivateTaskCmd.execute when the taskId constructor argument is null. The command cannot look up a task without an id, so it fails fast before touching the database.","triggerScenarios":"Calling taskService.activateTask(null) or constructing new ActivateTaskCmd(null); passing a variable that was never populated to taskService.activateTask(...).","commonSituations":"A null taskId returned from a lookup chain (e.g. taskQuery found nothing and the id variable defaulted to null); programmatic suspension helpers fed null after an earlier failed query.","solutions":["Ensure taskId is non-null before calling taskService.activateTask(taskId).","Check the source of the id: if it comes from Task.getId(), verify the task was actually created/queried successfully.","Guard the call site with an explicit null check or Objects.requireNonNull to fail earlier with a clearer message.","Fix upstream logic that returns null ids (e.g. singleResult() on an empty query)."],"exampleFix":"// before\ntaskService.activateTask(taskId); // taskId may be null\n// after\nif (taskId == null) {\n    throw new IllegalArgumentException(\"taskId must be provided\");\n}\ntaskService.activateTask(taskId);","handlingStrategy":"validation","validationCode":"java.util.Objects.requireNonNull(taskId, \"taskId must not be null\");\ntaskService.activateTask(taskId);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate taskId at API boundaries before invoking commands.","Ensure upstream queries return non-null ids (check singleResult() results).","Avoid flowing Optional.empty()/null ids into task operations."],"tags":["flowable","task","null-argument","activation"],"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"}