Hmbown/CodeWhale · warning

worker no longer has that running Fleet task

Error message

worker {worker_id} no longer has that running Fleet task

What it means

FleetManager::interrupt_worker cancels a worker's active task via the compare-and-set ledger call cancel_task_if_active (crates/tui/src/fleet/manager.rs:1057). If the compare-and-set loses — the task was completed, cancelled, re-leased to another worker, or finished between the state rebuild and the cancel — the method reports that the worker no longer has that running Fleet task. It is a lost-race signal, not a data corruption error.

Solutions

  1. Treat it as benign: re-inspect the worker (inspect_worker) to see its current state before retrying.
  2. Re-run interrupt_worker only if inspection still shows an active task; otherwise the interrupt already happened or is unnecessary.
  3. Serialize operator control commands (or check status first) so concurrent cancellations do not race.

Example fix

// before
manager.interrupt_worker(&worker_id)?;
// after
match manager.interrupt_worker(&worker_id) {
    Ok(inspection) => { /* cancelled */ }
    Err(e) if e.to_string().contains("no longer has that running Fleet task") => {
        let state = manager.inspect_worker(&worker_id)?; // already terminal or reassigned
    }
    Err(e) => return Err(e.into()),
}
Defensive patterns

Strategy: fallback

Validate before calling

if let Some(task) = manager.inspect_worker(worker_id)?.current_task_id {
    // worker still shows an active task; interrupt is likely to win
}

Try / catch

match manager.interrupt_worker(worker_id) {
    Ok(insp) => insp,
    Err(e) if e.to_string().contains("no longer has that running Fleet task") => manager.inspect_worker(worker_id)?, // benign race
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Calling interrupt_worker(worker_id) when the worker's task terminated or changed ownership after active_task_for_worker() was evaluated: the worker completed its task concurrently, another operator already cancelled it, or a restart reassigned the lease.

Common situations: An operator pressing interrupt at the exact moment the worker finishes; a monitoring script issuing interrupts in a loop while tasks are completing; duplicate interrupt commands racing each other.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/5c310cf839f6321d. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/fleet/manager.rs:1057

    pub fn interrupt_worker(&self, worker_id: &str) -> Result<FleetWorkerInspection> {
        let state = self.ledger.rebuild_state()?;
        let Some(task) = active_task_for_worker(&state, worker_id) else {
            return Err(FleetControlError::NoActiveTask {
                worker_id: worker_id.to_string(),
            }
            .into());
        };
        let cancelled = self.ledger.cancel_task_if_active(
            &task.entry.run_id,
            &task.entry.task_id,
            Some(worker_id),
            &timestamp(),
            Some("operator"),
            Some("operator"),
        )?;
        if !cancelled {
            bail!("worker {worker_id} no longer has that running Fleet task");
        }
        self.refresh_run_status(&task.entry.run_id)?;
        self.inspect_worker(worker_id)
    }

    pub fn restart_worker(&self, worker_id: &str) -> Result<FleetRestartReport> {
        let state = self.ledger.rebuild_state()?;
        let Some(task) = active_task_for_worker(&state, worker_id)
            .or_else(|| latest_task_for_worker(&state, worker_id))
        else {
            bail!("worker {worker_id} has no Fleet task to restart");
        };
        let run = state
            .runs
            .get(&task.entry.run_id.0)
            .ok_or_else(|| anyhow!("Fleet run {} does not exist", task.entry.run_id.0))?;
        let max_workers = run
            .max_workers

View on GitHub (pinned to 73e0f67d83)