Hmbown/CodeWhale · error

Fleet worker has no registered launch spec

Error message

Fleet worker {worker_id} has no registered launch spec

What it means

prepare_registered_restart_generation requires the worker to already have a registered record in SubAgentManager coordination state, because restart consumes and advances the worker's durable launch manifest. When get_worker_record(worker_id) returns None the worker was never registered with coordination (e.g. it launched before coordination was enabled) and restart cannot proceed safely.

Solutions

  1. Start the worker through the current manager path so it registers a launch spec before restart
  2. Re-enqueue the task instead of restarting an unregistered worker
  3. Clear the stale lease (stop/cancel task) and let the scheduler lease a fresh worker
  4. Check for a reset of SubAgentManager state while ledger tasks remain leased

Example fix

// before
let report = manager.restart_worker(worker_id)?;
// after
if !manager.worker_registered(worker_id) {
    manager.stop_worker(worker_id)?; // drop stale lease
    manager.start_run(&run_id)?;      // fresh lease registers a launch spec
} else {
    let report = manager.restart_worker(worker_id)?;
}
Defensive patterns

Strategy: validation

Validate before calling

fn can_restart(manager: &FleetManager, worker_id: &str) -> bool {
    manager.worker_registered(worker_id)
}

Try / catch

match manager.restart_worker(worker_id) {
    Err(e) if e.to_string().contains("no registered launch spec") => {
        // fall back: cancel stale lease and let scheduler lease a fresh worker
        manager.stop_worker(worker_id)?; manager.start_run(&run_id)?
    }
    other => other.map(|_| ())?,
}

Prevention

When it happens

Trigger: Calling restart_worker(worker_id) or resume_run where the leased worker has no SubAgentManager record — workers launched by an older process or before registration wiring existed, or the SubAgentManager was reset while the ledger still has tasks.

Common situations: Upgrading codewhale across versions where coordination registration was introduced; restarting a worker from a previous session whose in-memory coordination records are gone; running with sub_agent_manager set to None previously.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

            worker_runtime::apply_exec_hardening(
                worker_runtime::fleet_task_to_worker_spec_with_profiles(
                    worker_id,
                    &task.entry.run_id.0,
                    task_spec,
                    &worker_spec,
                    self.run_model(),
                    &cwd,
                    &self.workspace,
                    roster.members(),
                    None,
                )?,
                &self.exec_config,
            ),
            task.entry.attempts,
        );
        let record = coordination
            .get_worker_record(worker_id)
            .ok_or_else(|| anyhow!("Fleet worker {worker_id} has no registered launch spec"))?;
        let current_generation = task.entry.attempts.max(1);
        let next_generation = current_generation
            .checked_add(1)
            .ok_or_else(|| anyhow!("Fleet worker {worker_id} exhausted launch generations"))?;
        let registered_generation = record
            .spec
            .launch_manifest
            .as_ref()
            .map(|manifest| manifest.generation)
            .ok_or_else(|| anyhow!("Fleet worker {worker_id} has no persisted launch manifest"))?;

        match registered_generation {
            generation if generation == current_generation => {
                validate_registered_launch_spec(&record.spec, &expected_current)?;
                coordination
                    .advance_registered_worker_generation(bind_fleet_launch_attempt(
                        record.spec,
                        next_generation,

View on GitHub (pinned to 73e0f67d83)