{"record":{"id":"f523e6f00841d8cd","repo":"Hmbown/CodeWhale","slug":"fleet-task-references-unknown-agent-profile-pr","errorCode":null,"errorMessage":"fleet task {} references unknown agent profile {profile_id:?}","messagePattern":"fleet task (.+?) references unknown agent profile (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/worker_runtime.rs","lineNumber":732,"sourceCode":"\nfn resolve_task_agent_profile<'a>(\n    task_spec: &FleetTaskSpec,\n    agent_profiles: &'a [AgentProfile],\n) -> Result<Option<&'a AgentProfile>> {\n    let Some(profile_id) = task_spec\n        .worker\n        .as_ref()\n        .and_then(|worker| worker.agent_profile.as_deref())\n        .map(str::trim)\n        .filter(|id| !id.is_empty())\n    else {\n        return Ok(None);\n    };\n    let Some(profile) = agent_profiles\n        .iter()\n        .find(|profile| profile.id == profile_id)\n    else {\n        bail!(\n            \"fleet task {} references unknown agent profile {profile_id:?}\",\n            task_spec.id\n        );\n    };\n    Ok(Some(profile))\n}\n\nfn effective_fleet_role(\n    worker_profile: Option<&FleetTaskWorkerProfile>,\n    agent_profile: Option<&AgentProfile>,\n) -> Option<String> {\n    effective_fleet_role_with_source(worker_profile, agent_profile).0\n}\n\nfn effective_fleet_role_with_source(\n    worker_profile: Option<&FleetTaskWorkerProfile>,\n    agent_profile: Option<&AgentProfile>,\n) -> (Option<String>, Option<&'static str>) {","sourceCodeStart":714,"sourceCodeEnd":750,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/fleet/worker_runtime.rs#L714-L750","documentation":"The task's `worker.agent_profile` names a profile id that is not present in the loaded set of agent profiles. The lookup in `resolve agent profile` (crates/tui/src/fleet/worker_runtime.rs) does an exact id match over the profiles discovered from their TOML files; the reference is trimmed and empty values are ignored, but any non-empty unknown id aborts the task. The id is printed with {:?} so stray whitespace is visible in the message.","triggerScenarios":"`agent_profile = \"implementer\"` when the profiles directory only defines \"coder\"; a renamed or deleted profile file; profile discovery rooted at a different directory than the one containing your profile; a typo or invisible trailing space in the id.","commonSituations":"Sharing task specs across machines with different profile sets; reorganizing .codewhale/fleet profile files; profiles behind a gitignored path that was never created on a fresh clone.","solutions":["Check the printed id (it is quoted, so whitespace shows) and fix typos or trailing spaces in the task's `agent_profile`.","Verify the profile exists: list the discovered agent profile TOML files and confirm one has `id = \"<that value>\"`.","If the profile was renamed, update the task to the new id — or drop `agent_profile` to fall back to role/defaults."],"exampleFix":"# before\n[worker]\nagent_profile = \"implementer \"   # profile file defines id = \"implementer\"\n\n# after\n[worker]\nagent_profile = \"implementer\"","handlingStrategy":"validation","validationCode":"fn all_profiles_resolve(tasks: &[FleetTaskSpec], profiles: &[AgentProfile]) -> Option<String> {\n    for task in tasks {\n        if let Some(id) = task.worker.as_ref().and_then(|w| w.agent_profile.as_deref()) {\n            let id = id.trim();\n            if !id.is_empty() && !profiles.iter().any(|p| p.id == id) {\n                return Some(format!(\"{} -> {}\", task.id, id));\n            }\n        }\n    }\n    None\n}","typeGuard":"fn profile_exists(profile_id: &str, profiles: &[AgentProfile]) -> bool {\n    profiles.iter().any(|p| p.id == profile_id.trim())\n}","tryCatchPattern":null,"preventionTips":["Commit fleet profile TOMLs alongside task specs so references stay resolvable.","When renaming a profile id, grep task specs for the old value in the same change.","Add a preflight that cross-checks every agent_profile reference against discovered profiles."],"tags":["fleet","agent-profile","config-reference","validation","rust"],"backgroundTag":"unknown-config-reference","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}