Hmbown/CodeWhale · error

scheduling Fleet run

Error message

scheduling Fleet run {} after draining owned workers

What it means

The Fleet manager drained owned workers for a run and then tried to reschedule the run while excluding those workers. If rescheduling fails and the executor now has zero workers, the original scheduling error is returned wrapped with this context, explaining that the failure happened while re-scheduling after draining. The context preserves the run_id for diagnosis.

Solutions

  1. Start or restore worker capacity so the run has a node to schedule on.
  2. Check why the owned workers were drained (crash, eviction, intentional shutdown) and fix the underlying cause.
  3. Verify max_workers and run configuration match the number of available workers.
  4. Inspect the wrapped scheduling error for the specific reason the exclusion-based placement failed.
Defensive patterns

Strategy: fallback

Validate before calling

// before driving a run, confirm schedulable capacity exists
if available_worker_count() == 0 { return Err("no workers available for Fleet run"); }

Prevention

When it happens

Trigger: In the Fleet run-driving path: schedule_run_excluding(run_id, max_workers, unavailable_workers) returns Err, and executor.worker_ids().is_empty() after the drain — meaning no workers remain that could host the run.

Common situations: All workers owned by the executor were drained (shutdown, eviction, unhealthy nodes) and no other capacity exists; max_workers set higher than available nodes; a cluster scaled to zero mid-run.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

                        format!(
                            "locking Fleet manager ownership {}",
                            manager_lock_path.display()
                        )
                    });
                }
            }
        };
        loop {
            // A terminal ledger update can race the foreground host process.
            // Do not lease new work onto a logical worker until its executor
            // handle has been observed and forgotten below.
            let unavailable_workers = executor.worker_ids().into_iter().collect();
            let scheduling_error = self
                .schedule_run_excluding(run_id, max_workers, &unavailable_workers)
                .err();
            self.drive_executor_tick(run_id, executor, codewhale_binary, model)?;
            self.refresh_run_status(run_id)?;
            if let Some(error) = scheduling_error {
                if executor.worker_ids().is_empty() {
                    return Err(error).with_context(|| {
                        format!(
                            "scheduling Fleet run {} after draining owned workers",
                            run_id.0
                        )
                    });
                }
                tracing::warn!(
                    run_id = %run_id.0,
                    error = %error,
                    "Fleet scheduling paused while already-leased workers continue"
                );
            }
            // A separate `fleet interrupt` process can make the ledger
            // terminal while this manager still owns a live host child. Keep
            // driving until the executor has observed that cancellation and
            // stopped every tracked process.

View on GitHub (pinned to 73e0f67d83)