{"record":{"id":"5a2ef44244224da8","repo":"flowable/flowable-engine","slug":"taskid-is-null","errorCode":null,"errorMessage":"taskId is null","messagePattern":"taskId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ActivateTaskCmd.java","lineNumber":48,"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        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        \n        if (taskId == null) {\n            throw new FlowableIllegalArgumentException(\"taskId is null\");\n        }\n\n        TaskEntity task = cmmnEngineConfiguration.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 \" + taskId + \" is already deleted\");\n        }\n\n        if (!task.isSuspended()) {\n            throw new FlowableException(\"Task \" + taskId + \" is not suspended, so can't be activated\");\n        }\n        \n        Clock clock = cmmnEngineConfiguration.getClock();\n        Date updateTime = clock.getCurrentTime();","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/ActivateTaskCmd.java#L30-L66","documentation":"FlowableIllegalArgumentException thrown by ActivateTaskCmd.execute when taskId is null. The command activates (un-suspends) a suspended CMMN human task, but it requires a task id to look up the TaskEntity via the task service. A null id fails the guard before any lookup.","triggerScenarios":"Calling cmmnTaskService.activateTask(null) or the task service activate API with a null taskId variable; id lost when mapping from another object; REST request missing the task id.","commonSituations":"Batch activation scripts where some records lack task ids; wiring error in code that passes a variable intended to hold the task id but never assigned; form submission where the task id field is absent.","solutions":["Validate taskId non-null before calling activateTask","Resolve the task id from the plan item or task query instead of assuming it is set","Fix the REST/controller layer to require the task id parameter","Check the code path that should have populated the taskId for a null-returning call"],"exampleFix":"// before\ncmmnTaskService.activateTask(taskId); // taskId may be null\n// after\nif (taskId == null || taskId.isBlank()) {\n    throw new IllegalArgumentException(\"taskId is required\");\n}\ncmmnTaskService.activateTask(taskId);","handlingStrategy":"validation","validationCode":"if (taskId == null || taskId.isBlank()) throw new IllegalArgumentException(\"taskId is required\");","typeGuard":"boolean hasTaskId(String id) { return id != null && !id.isBlank(); }","tryCatchPattern":"try { cmmnTaskService.activateTask(taskId); }\ncatch (FlowableIllegalArgumentException e) { log.error(\"Missing/invalid taskId: {}\", e.getMessage()); }","preventionTips":["Validate ids at the service entry point","Do not propagate nullable ids from DTOs into engine calls","Derive task ids from task queries rather than assumed variables","Enforce required path/query parameters in the REST layer"],"tags":["flowable","cmmn","null-argument","task"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}