Hmbown/CodeWhale · error

fleet run does not exist

Error message

fleet run {} does not exist

What it means

FleetManager::stop_run rebuilds ledger state and looks up the requested run id; this error means the id is absent from the ledger, so there is nothing to stop — typically a stale run id from a finished or already-cancelled run, or a typo.

Solutions

  1. List runs from the same manager to copy the exact run id
  2. Verify the state/run directory the manager was constructed with
  3. If the run was just created, wait for its creation to be durably appended before issuing control commands
Defensive patterns

Strategy: validation

Validate before calling

// verify the run exists before controlling it
let exists = manager
    .run_status(&run_id)
    .map(|_| true)
    .unwrap_or(false);
assert!(exists, "unknown fleet run id");

Try / catch

match manager.stop_run(&run_id) {
    Ok(n) => Ok(n),
    Err(err) if err.to_string().contains("does not exist") => Ok(0), // already gone; idempotent
    Err(err) => Err(err),
}

Prevention

When it happens

Trigger: Calling stop_run with a mistyped or truncated run id, an id from a different state directory, or before the run's creation event was persisted.

Common situations: Stopping a run by a display-truncated id copied from the UI; shell history reuse after switching projects/state dirs; racing run creation.

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


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/2dcb7bc2ec879b8e. Report an issue: GitHub.

Appendix: source

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

                continue;
            }
            affected_runs.insert(task.entry.run_id.0.clone());
            stopped += 1;
        }
        for run_id in affected_runs {
            self.ledger.update_run_status(
                &FleetRunId::from(run_id),
                FleetRunStatus::Cancelled,
                &timestamp(),
            )?;
        }
        Ok(stopped)
    }

    pub fn stop_run(&self, run_id: &FleetRunId) -> Result<usize> {
        let state = self.ledger.rebuild_state()?;
        if !state.runs.contains_key(&run_id.0) {
            bail!("fleet run {} does not exist", run_id.0);
        }
        let now = timestamp();
        let mut stopped = 0usize;
        for task in state
            .tasks
            .values()
            .filter(|task| task.entry.run_id == *run_id)
        {
            if !matches!(
                task.status,
                FleetTaskLedgerStatus::Enqueued | FleetTaskLedgerStatus::Leased
            ) {
                continue;
            }
            if !self.ledger.cancel_task_if_active(
                &task.entry.run_id,
                &task.entry.task_id,
                None,

View on GitHub (pinned to 0c42157ee5)