{"record":{"id":"068373befb0f241f","repo":"Hmbown/CodeWhale","slug":"fleet-worker-worker-id-has-no-registered-launch","errorCode":null,"errorMessage":"Fleet worker {worker_id} has no registered launch spec","messagePattern":"Fleet worker (.+?) has no registered launch spec","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/manager.rs","lineNumber":1184,"sourceCode":"            worker_runtime::apply_exec_hardening(\n                worker_runtime::fleet_task_to_worker_spec_with_profiles(\n                    worker_id,\n                    &task.entry.run_id.0,\n                    task_spec,\n                    &worker_spec,\n                    self.run_model(),\n                    &cwd,\n                    &self.workspace,\n                    roster.members(),\n                    None,\n                )?,\n                &self.exec_config,\n            ),\n            task.entry.attempts,\n        );\n        let record = coordination\n            .get_worker_record(worker_id)\n            .ok_or_else(|| anyhow!(\"Fleet worker {worker_id} has no registered launch spec\"))?;\n        let current_generation = task.entry.attempts.max(1);\n        let next_generation = current_generation\n            .checked_add(1)\n            .ok_or_else(|| anyhow!(\"Fleet worker {worker_id} exhausted launch generations\"))?;\n        let registered_generation = record\n            .spec\n            .launch_manifest\n            .as_ref()\n            .map(|manifest| manifest.generation)\n            .ok_or_else(|| anyhow!(\"Fleet worker {worker_id} has no persisted launch manifest\"))?;\n\n        match registered_generation {\n            generation if generation == current_generation => {\n                validate_registered_launch_spec(&record.spec, &expected_current)?;\n                coordination\n                    .advance_registered_worker_generation(bind_fleet_launch_attempt(\n                        record.spec,\n                        next_generation,","sourceCodeStart":1166,"sourceCodeEnd":1202,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/manager.rs#L1166-L1202","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Start the worker through the current manager path so it registers a launch spec before restart","Re-enqueue the task instead of restarting an unregistered worker","Clear the stale lease (stop/cancel task) and let the scheduler lease a fresh worker","Check for a reset of SubAgentManager state while ledger tasks remain leased"],"exampleFix":"// before\nlet report = manager.restart_worker(worker_id)?;\n// after\nif !manager.worker_registered(worker_id) {\n    manager.stop_worker(worker_id)?; // drop stale lease\n    manager.start_run(&run_id)?;      // fresh lease registers a launch spec\n} else {\n    let report = manager.restart_worker(worker_id)?;\n}","handlingStrategy":"validation","validationCode":"fn can_restart(manager: &FleetManager, worker_id: &str) -> bool {\n    manager.worker_registered(worker_id)\n}","typeGuard":null,"tryCatchPattern":"match manager.restart_worker(worker_id) {\n    Err(e) if e.to_string().contains(\"no registered launch spec\") => {\n        // fall back: cancel stale lease and let scheduler lease a fresh worker\n        manager.stop_worker(worker_id)?; manager.start_run(&run_id)?\n    }\n    other => other.map(|_| ())?,\n}","preventionTips":["Always launch fleet workers through the current manager so coordination registration happens","After upgrading versions, clear leases held by pre-upgrade processes","Avoid resetting SubAgentManager while ledger tasks are still leased"],"tags":["fleet","coordination","worker-registration"],"backgroundTag":"record-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"}