{"record":{"id":"f3b02212c0f4fc04","repo":"Hmbown/CodeWhale","slug":"parsing-agent-profile-err","errorCode":null,"errorMessage":"parsing agent profile {}: {err}","messagePattern":"parsing agent profile (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/profile.rs","lineNumber":308,"sourceCode":"    let fallback_id = path\n        .file_stem()\n        .and_then(|value| value.to_str())\n        .unwrap_or(\"profile\");\n    let id = first_present([parsed.id.as_deref(), parsed.name.as_deref()])\n        .unwrap_or(fallback_id)\n        .to_string();\n    validate_agent_profile_token(path, \"id/name\", &id)?;\n    Ok(AgentProfileIdentity {\n        id,\n        source: path.to_path_buf(),\n    })\n}\n\nfn load_agent_profile_file(path: &Path) -> Result<AgentProfile> {\n    let raw = std::fs::read_to_string(path)\n        .with_context(|| format!(\"reading agent profile {}\", path.display()))?;\n    let parsed: AgentProfileToml = toml::from_str(&raw)\n        .map_err(|err| anyhow!(\"parsing agent profile {}: {err}\", path.display()))?;\n    agent_profile_from_toml(path, parsed)\n}\n\nfn agent_profile_from_toml(path: &Path, parsed: AgentProfileToml) -> Result<AgentProfile> {\n    reject_permission_expansion(path, parsed.tools.as_ref(), parsed.permissions.as_ref())?;\n\n    let fallback_id = path\n        .file_stem()\n        .and_then(|value| value.to_str())\n        .unwrap_or(\"profile\");\n    let id = first_present([parsed.id.as_deref(), parsed.name.as_deref()])\n        .unwrap_or(fallback_id)\n        .to_string();\n    validate_agent_profile_token(path, \"id/name\", &id)?;\n\n    let role_name = canonical_public_role_name(\n        first_present([\n            parsed.base_role.as_deref(),","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/fleet/profile.rs#L290-L326","documentation":"Error \"parsing agent profile {}: {err}\" thrown in Hmbown/CodeWhale.","triggerScenarios":"Thrown at crates/tui/src/fleet/profile.rs:308 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}