{"record":{"id":"ef97ac3a5ceccfb5","repo":"Hmbown/CodeWhale","slug":"worker-worker-id-has-no-fleet-task-to-restart","errorCode":null,"errorMessage":"worker {worker_id} has no fleet task to restart","messagePattern":"worker (.+?) has no fleet task to restart","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/manager.rs","lineNumber":1029,"sourceCode":"            &task.entry.task_id,\n            Some(worker_id),\n            &timestamp(),\n            Some(\"operator\"),\n            Some(\"operator\"),\n        )?;\n        if !cancelled {\n            bail!(\"worker {worker_id} no longer has that running fleet task\");\n        }\n        self.refresh_run_status(&task.entry.run_id)?;\n        self.inspect_worker(worker_id)\n    }\n\n    pub fn restart_worker(&self, worker_id: &str) -> Result<FleetRestartReport> {\n        let state = self.ledger.rebuild_state()?;\n        let Some(task) = active_task_for_worker(&state, worker_id)\n            .or_else(|| latest_task_for_worker(&state, worker_id))\n        else {\n            bail!(\"worker {worker_id} has no fleet task to restart\");\n        };\n        let run = state\n            .runs\n            .get(&task.entry.run_id.0)\n            .ok_or_else(|| anyhow!(\"fleet run {} does not exist\", task.entry.run_id.0))?;\n        let max_workers = run\n            .max_workers\n            .unwrap_or_else(|| run.worker_specs.len().max(1))\n            .clamp(1, 128);\n        let mut coordination_guard = match &self.sub_agent_manager {\n            Some(manager) => {\n                let Ok(guard) = manager.try_write() else {\n                    bail!(\"Fleet worker {worker_id} coordination state is busy; retry restart\");\n                };\n                Some(guard)\n            }\n            None => None,\n        };","sourceCodeStart":1011,"sourceCodeEnd":1047,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/fleet/manager.rs#L1011-L1047","documentation":"FleetManager::restart_worker requires the worker to have an active task, or at least a latest (historical) task, in the rebuilt ledger state. Neither lookup succeeded, so there is nothing to restart: the worker id never received a task in any run this manager can see.","triggerScenarios":"Calling restart_worker with a worker id that has no tasks in the rebuilt ledger: a typo'd id, an id from a different run directory, or a worker whose events were never written.","commonSituations":"Copy-pasting a worker id from an old run; referencing a worker by its spec id while the ledger keys by lease-assigned id; pointing CODEWHALE state at the wrong directory so the ledger rebuilds without that worker's history.","solutions":["List workers/tasks from the same ledger state to get the exact worker id spelling","Confirm you are operating on the correct run and state directory","If the worker should have history, check that its task events were appended to the ledger and were not lost","Use a launch/assign API to give the worker a task before restarting it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before restarting, confirm the worker appears in current state\nlet state = manager.ledger_state()?; // or expose a list/inspect API\nlet known = manager.inspect_worker(&worker_id).is_ok();\nassert!(known, \"worker id unknown to this fleet state\");","typeGuard":null,"tryCatchPattern":"match manager.restart_worker(&worker_id) {\n    Ok(report) => Ok(report),\n    Err(err) if err.to_string().contains(\"no fleet task to restart\") => {\n        eprintln!(\"worker {worker_id} has no task history; check the id and run\");\n        Err(err)\n    }\n    Err(err) => Err(err),\n}","preventionTips":["Copy worker ids from a live listing, never from scrollback","Validate that worker ids come from the same run/state directory you are managing"],"tags":["fleet","worker-not-found","rust","codewhale"],"backgroundTag":"entity-not-found","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}