{"record":{"id":"1ebc8db68cecc147","repo":"flowable/flowable-engine","slug":"cannot-find-task-with-id-taskid-1ebc8d","errorCode":null,"errorMessage":"Cannot find task with id {taskId}","messagePattern":"Cannot find task with id (.+?)","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ActivateTaskCmd.java","lineNumber":51,"sourceCode":"    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();\n        task.setSuspendedTime(null);\n        task.setSuspendedBy(null);\n        if (task.getInProgressStartTime() != null) {\n            task.setState(Task.IN_PROGRESS);\n        } else if (task.getClaimTime() != null) {\n            task.setState(Task.CLAIMED);","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ActivateTaskCmd.java#L33-L69","documentation":"FlowableObjectNotFoundException thrown by ActivateTaskCmd.execute when no task exists with the supplied taskId. The command loads the task via the task service; a null result means the id is unknown, deleted, or belongs to another database/schema.","triggerScenarios":"taskService.activateTask(id) with an id that was never created, references a completed (and cleaned-up) task, or points at a different database/schema.","commonSituations":"Activating a task after the process instance was removed; multi-tenant/multi-schema setups querying the wrong schema; stale ids cached in external systems; typo'd ids from logs.","solutions":["Verify the task exists first: taskService.createTaskQuery().taskId(id).singleResult() != null.","Check the process instance/history to confirm the task was completed rather than deleted.","Confirm the engine connects to the same database schema where the task was created.","If the task was completed already, skip activation (a completed task cannot be suspended/activated)."],"exampleFix":"// before\ntaskService.activateTask(taskId);\n// after\nTask task = taskService.createTaskQuery().taskId(taskId).singleResult();\nif (task != null) {\n    taskService.activateTask(taskId);\n}","handlingStrategy":"validation","validationCode":"Task t = taskService.createTaskQuery().taskId(taskId).singleResult();\nif (t == null) {\n    return; // nothing to activate\n}\ntaskService.activateTask(taskId);","typeGuard":null,"tryCatchPattern":"try {\n    taskService.activateTask(taskId);\n} catch (FlowableObjectNotFoundException e) {\n    // task gone (completed/deleted); skip\n}","preventionTips":["Query the task before suspension-state changes.","Clean up scheduled task operations when instances complete.","Confirm schema/tenant consistency across environments."],"tags":["flowable","task","not-found","activation"],"backgroundTag":"entity-not-found","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"}