{"record":{"id":"ce80d3ab9a0b7fda","repo":"conductor-oss/conductor","slug":"no-such-task-found-by-taskid-s","errorCode":null,"errorMessage":"No such task found by taskId: %s","messagePattern":"No such task found by taskId: (.+?)","errorType":"exception","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"core/src/main/java/com/netflix/conductor/service/ExecutionService.java","lineNumber":397,"sourceCode":"        return queueDAO.ack(QueueUtils.getQueueName(task), task.getTaskId());\n    }\n\n    public Map<String, Integer> getTaskQueueSizes(List<String> taskDefNames) {\n        Map<String, Integer> sizes = new HashMap<>();\n        for (String taskDefName : taskDefNames) {\n            sizes.put(taskDefName, getTaskQueueSize(taskDefName));\n        }\n        return sizes;\n    }\n\n    public Integer getTaskQueueSize(String queueName) {\n        return queueDAO.getSize(queueName);\n    }\n\n    public void removeTaskFromQueue(String taskId) {\n        Task task = getTask(taskId);\n        if (task == null) {\n            throw new NotFoundException(\"No such task found by taskId: %s\", taskId);\n        }\n        queueDAO.remove(QueueUtils.getQueueName(task), taskId);\n    }\n\n    public int requeuePendingTasks(String taskType) {\n\n        int count = 0;\n        List<Task> tasks = getPendingTasksForTaskType(taskType);\n\n        for (Task pending : tasks) {\n\n            if (systemTaskRegistry.isSystemTask(pending.getTaskType())) {\n                continue;\n            }\n            if (pending.getStatus().isTerminal()) {\n                continue;\n            }\n","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/core/src/main/java/com/netflix/conductor/service/ExecutionService.java#L379-L415","documentation":"Thrown by ExecutionService.removeTaskFromQueue when no task with the given taskId exists in the execution store. The method first looks up the task by ID and throws NotFoundException (HTTP 404) if the lookup returns null. This prevents attempting to remove a non-existent task from the queue.","triggerScenarios":"Calling the task removal API (DELETE /api/queue/task/{taskId} or the removeTaskFromQueue service method) with a taskId that doesn't correspond to any task in the datastore. Also when the task was already deleted or its TTL expired before the removal call.","commonSituations":"Stale taskId from an already-completed or already-deleted task. Typo or truncation in the taskId. Task data expired from the datastore (TTL). Calling removeTaskFromQueue in a retry/idempotent path after the task was already removed on a previous attempt. Race condition where the task was cleaned up between a list call and the remove call.","solutions":["Verify the taskId is correct by checking it exists via GET /api/tasks/{taskId} before calling remove.","If this is a retry/idempotent path, catch NotFoundException and treat it as a no-op (task already gone).","Check for data TTL expiration — if tasks expire quickly, increase the TTL or handle the 404 gracefully.","Use the task status check to skip removal for tasks already in a terminal state."],"exampleFix":"// before — unguarded removal\nexecutionService.removeTaskFromQueue(taskId);\n\n// after — guard with existence check or catch\ntry {\n    executionService.removeTaskFromQueue(taskId);\n} catch (NotFoundException e) {\n    // task already gone — idempotent, safe to ignore\n    LOGGER.debug(\"Task {} already removed\", taskId);\n}","handlingStrategy":"try-catch","validationCode":"// Check task existence before removal\nTask task = executionService.getTask(taskId);\nif (task == null) {\n    LOGGER.debug(\"Task {} does not exist — nothing to remove from queue\", taskId);\n    return;\n}\nexecutionService.removeTaskFromQueue(taskId);","typeGuard":null,"tryCatchPattern":"try {\n    executionService.removeTaskFromQueue(taskId);\n} catch (NotFoundException e) {\n    // Task already gone — idempotent removal, safe to ignore\n    LOGGER.debug(\"Task {} not found during queue removal (already gone?)\", taskId);\n}","preventionTips":["Treat removeTaskFromQueue as idempotent — catch NotFoundException for retries.","Verify taskId format and existence before queue manipulation in cleanup scripts.","Use terminal-status checks instead of queue removal when possible."],"tags":["task","queue","not-found","api"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}