Hmbown/CodeWhale · error
worker {worker_id} has no fleet task to restart
Error message
worker {worker_id} has no fleet task to restart What it means
FleetManager::restart_worker requires the worker to have an active task, or at least a latest (historical) task, in the rebuilt ledger state. Neither lookup succeeded, so there is nothing to restart: the worker id never received a task in any run this manager can see.
Source
Thrown at crates/tui/src/fleet/manager.rs:1029
&task.entry.task_id,
Some(worker_id),
×tamp(),
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
.unwrap_or_else(|| run.worker_specs.len().max(1))
.clamp(1, 128);
let mut coordination_guard = match &self.sub_agent_manager {
Some(manager) => {
let Ok(guard) = manager.try_write() else {
bail!("Fleet worker {worker_id} coordination state is busy; retry restart");
};
Some(guard)
}
None => None,
};View on GitHub (pinned to 0c42157ee5)
Solutions
- List workers/tasks from the same ledger state to get the exact worker id spelling
- Confirm you are operating on the correct run and state directory
- If the worker should have history, check that its task events were appended to the ledger and were not lost
- Use a launch/assign API to give the worker a task before restarting it
Defensive patterns
Strategy: validation
Validate before calling
// before restarting, confirm the worker appears in current state let state = manager.ledger_state()?; // or expose a list/inspect API let known = manager.inspect_worker(&worker_id).is_ok(); assert!(known, "worker id unknown to this fleet state");
Try / catch
match manager.restart_worker(&worker_id) {
Ok(report) => Ok(report),
Err(err) if err.to_string().contains("no fleet task to restart") => {
eprintln!("worker {worker_id} has no task history; check the id and run");
Err(err)
}
Err(err) => Err(err),
} Prevention
- Copy worker ids from a live listing, never from scrollback
- Validate that worker ids come from the same run/state directory you are managing
When it happens
Trigger: Calling restart_worker with a worker id that has no tasks in the rebuilt ledger: a typo'd id, an id from a different run directory, or a worker whose events were never written.
Common situations: Copy-pasting a worker id from an old run; referencing a worker by its spec id while the ledger keys by lease-assigned id; pointing CODEWHALE state at the wrong directory so the ledger rebuilds without that worker's history.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- fleet run {} is already terminal ({lifecycle:?})
- fleet manager for run {} exited with open work; wait for sta
- worker {worker_id} no longer has that running fleet task
- Fleet worker {worker_id} coordination state is busy; retry r
- worker {worker_id} task changed before it could be restarted
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/ef97ac3a5ceccfb5.
Report an issue: GitHub.