conductor-oss/conductor · error · NotFoundException

No such task found by taskId: %s

Error message

No such task found by taskId: %s

What it means

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.

Source

Thrown at core/src/main/java/com/netflix/conductor/service/ExecutionService.java:397

        return queueDAO.ack(QueueUtils.getQueueName(task), task.getTaskId());
    }

    public Map<String, Integer> getTaskQueueSizes(List<String> taskDefNames) {
        Map<String, Integer> sizes = new HashMap<>();
        for (String taskDefName : taskDefNames) {
            sizes.put(taskDefName, getTaskQueueSize(taskDefName));
        }
        return sizes;
    }

    public Integer getTaskQueueSize(String queueName) {
        return queueDAO.getSize(queueName);
    }

    public void removeTaskFromQueue(String taskId) {
        Task task = getTask(taskId);
        if (task == null) {
            throw new NotFoundException("No such task found by taskId: %s", taskId);
        }
        queueDAO.remove(QueueUtils.getQueueName(task), taskId);
    }

    public int requeuePendingTasks(String taskType) {

        int count = 0;
        List<Task> tasks = getPendingTasksForTaskType(taskType);

        for (Task pending : tasks) {

            if (systemTaskRegistry.isSystemTask(pending.getTaskType())) {
                continue;
            }
            if (pending.getStatus().isTerminal()) {
                continue;
            }

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Verify the taskId is correct by checking it exists via GET /api/tasks/{taskId} before calling remove.
  2. If this is a retry/idempotent path, catch NotFoundException and treat it as a no-op (task already gone).
  3. Check for data TTL expiration — if tasks expire quickly, increase the TTL or handle the 404 gracefully.
  4. Use the task status check to skip removal for tasks already in a terminal state.

Example fix

// before — unguarded removal
executionService.removeTaskFromQueue(taskId);

// after — guard with existence check or catch
try {
    executionService.removeTaskFromQueue(taskId);
} catch (NotFoundException e) {
    // task already gone — idempotent, safe to ignore
    LOGGER.debug("Task {} already removed", taskId);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Check task existence before removal
Task task = executionService.getTask(taskId);
if (task == null) {
    LOGGER.debug("Task {} does not exist — nothing to remove from queue", taskId);
    return;
}
executionService.removeTaskFromQueue(taskId);

Try / catch

try {
    executionService.removeTaskFromQueue(taskId);
} catch (NotFoundException e) {
    // Task already gone — idempotent removal, safe to ignore
    LOGGER.debug("Task {} not found during queue removal (already gone?)", taskId);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/ce80d3ab9a0b7fda. Report an issue: GitHub.