{"record":{"id":"15fffd52b0d9b642","repo":"Hmbown/CodeWhale","slug":"fleet-task-has-invalid-worker-agent-profile-selector","errorCode":null,"errorMessage":"Fleet task {} has invalid worker.agent_profile selector {selector:?}: {error}","messagePattern":"Fleet task (.+?) has invalid worker\\.agent_profile selector (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/worker_runtime.rs","lineNumber":172,"sourceCode":"            }\n            continue;\n        };\n        let explicit_selector = worker\n            .agent_profile\n            .as_deref()\n            .map(str::trim)\n            .filter(|selector| !selector.is_empty())\n            .map(str::to_string);\n        let legacy_role_selector = worker\n            .role\n            .as_deref()\n            .map(str::trim)\n            .filter(|selector| !selector.is_empty())\n            .map(str::to_string);\n\n        let selected = if let Some(selector) = explicit_selector.as_deref() {\n            let selected = resolve_member_in_profiles(agent_profiles, selector).map_err(|error| {\n                anyhow::anyhow!(\n                    \"Fleet task {} has invalid worker.agent_profile selector {selector:?}: {error}\",\n                    task.id\n                )\n            })?;\n            Some(selected.ok_or_else(|| {\n                anyhow::anyhow!(\n                    \"Fleet task {} references unknown agent profile selector {selector:?}\",\n                    task.id\n                )\n            })?)\n        } else if let Some(selector) = legacy_role_selector.as_deref() {\n            // `role` was historically only a posture. Preserve that contract\n            // when no exact Fleet is selected and a roster lookup is absent.\n            // Ambiguity is never a posture: silently dropping it would make a\n            // selected team launch an anonymous session-route worker.\n            match resolve_member_in_profiles(agent_profiles, selector).map_err(|error| {\n                anyhow::anyhow!(\n                    \"Fleet task {} has invalid worker.role member selector {selector:?}: {error}\",","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/worker_runtime.rs#L154-L190","documentation":"Thrown by freeze_fleet_task_members when a task's explicit worker.agent_profile selector fails resolve_member_in_profiles with an internal error (not merely 'no match'). It wraps the resolver's error with the task id and selector, so a task cannot be frozen with a malformed selector string. Distinct from error 1766, which covers a well-formed selector that matches nothing.","triggerScenarios":"Freezing a Fleet task whose metadata names worker.agent_profile = \"<selector>\" where resolve_member_in_profiles returns Err — e.g. a selector with invalid structure (empty components, malformed 'kind:name' syntax) rather than an unknown name.","commonSituations":"Hand-written selector in task config using wrong syntax (missing colon, stray whitespace patterns the resolver rejects); copy-pasted selector from another fleet with different naming conventions.","solutions":["Fix the selector syntax per the wrapped resolve_member_in_profiles error (the inner message names the concrete problem).","Use an exact existing member/profile name as the agent_profile value.","Remove the worker.agent_profile key if the task should inherit the roster's default posture instead.","Validate selectors against the loaded profile list before writing task metadata."],"exampleFix":"// before\nagent_profile = \"Reviewer (1)\"\n// after\nagent_profile = \"reviewer\"","handlingStrategy":"validation","validationCode":"// Rust\nif let Some(sel) = task.worker.agent_profile.as_deref().map(str::trim).filter(|s| !s.is_empty()) {\n    if resolve_member_in_profiles(&profiles, sel).is_err() {\n        eprintln!(\"selector {sel:?} invalid before freeze\");\n    }\n}","typeGuard":null,"tryCatchPattern":"// Rust\nmatch freeze_fleet_task_members(&task, &profiles) {\n    Err(e) if e.to_string().contains(\"invalid worker.agent_profile selector\") => {\n        log::warn!(\"fixing selector for task {}\", task.id);\n    }\n    other => other?,\n}","preventionTips":["Generate selectors from profile ids programmatically instead of typing them.","Trim and normalize selector values when writing task metadata.","Test-freeze tasks in CI against the loaded profile roster."],"tags":["fleet","selector","validation","worker"],"backgroundTag":"invalid-argument-value","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"}