{"record":{"id":"ad7de4a921eacf6c","repo":"Hmbown/CodeWhale","slug":"scheduling-fleet-run-after-draining-owned-worke","errorCode":null,"errorMessage":"scheduling Fleet run {} after draining owned workers","messagePattern":"scheduling Fleet run (.+?) after draining owned workers","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/manager.rs","lineNumber":808,"sourceCode":"                        format!(\n                            \"locking Fleet manager ownership {}\",\n                            manager_lock_path.display()\n                        )\n                    });\n                }\n            }\n        };\n        loop {\n            // A terminal ledger update can race the foreground host process.\n            // Do not lease new work onto a logical worker until its executor\n            // handle has been observed and forgotten below.\n            let unavailable_workers = executor.worker_ids().into_iter().collect();\n            let scheduling_error = self\n                .schedule_run_excluding(run_id, max_workers, &unavailable_workers)\n                .err();\n            self.drive_executor_tick(run_id, executor, codewhale_binary, model)?;\n            self.refresh_run_status(run_id)?;\n            if let Some(error) = scheduling_error {\n                if executor.worker_ids().is_empty() {\n                    return Err(error).with_context(|| {\n                        format!(\n                            \"scheduling Fleet run {} after draining owned workers\",\n                            run_id.0\n                        )\n                    });\n                }\n                tracing::warn!(\n                    run_id = %run_id.0,\n                    error = %error,\n                    \"Fleet scheduling paused while already-leased workers continue\"\n                );\n            }\n            // A separate `fleet interrupt` process can make the ledger\n            // terminal while this manager still owns a live host child. Keep\n            // driving until the executor has observed that cancellation and\n            // stopped every tracked process.","sourceCodeStart":790,"sourceCodeEnd":826,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/manager.rs#L790-L826","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Start or restore worker capacity so the run has a node to schedule on.","Check why the owned workers were drained (crash, eviction, intentional shutdown) and fix the underlying cause.","Verify max_workers and run configuration match the number of available workers.","Inspect the wrapped scheduling error for the specific reason the exclusion-based placement failed."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// before driving a run, confirm schedulable capacity exists\nif available_worker_count() == 0 { return Err(\"no workers available for Fleet run\"); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep spare worker capacity so draining never leaves zero nodes.","Monitor worker health to catch drains before they strand runs.","Align max_workers settings with actual cluster size."],"tags":["fleet","scheduling","workers","no-capacity"],"backgroundTag":"resource-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}