{"record":{"id":"b44d9bfcc391bcd8","repo":"Hmbown/CodeWhale","slug":"agent-profile-model-must-be-a-visible-model-id","errorCode":null,"errorMessage":"agent profile {} model must be a visible model id without whitespace or secrets","messagePattern":"agent profile (.+?) model must be a visible model id without whitespace or secrets","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/profile.rs","lineNumber":482,"sourceCode":"    let trimmed = value.trim();\n    if trimmed.is_empty() {\n        bail!(\"agent profile {} {field} cannot be empty\", path.display());\n    }\n    if trimmed != value || !trimmed.chars().all(is_agent_profile_token_char) {\n        bail!(\n            \"agent profile {} {field} must be a simple token\",\n            path.display()\n        );\n    }\n    Ok(())\n}\n\nfn validate_agent_profile_model_hint(path: &Path, value: Option<&str>) -> Result<()> {\n    let Some(value) = value else {\n        return Ok(());\n    };\n    if !is_model_hint(value) {\n        bail!(\n            \"agent profile {} model must be a visible model id without whitespace or secrets\",\n            path.display()\n        );\n    }\n    Ok(())\n}\n\n/// Validate an explicit `provider` field as a safe provider id (#4093).\n///\n/// Built-in providers are accepted by the runtime vocabulary, and user-named\n/// OpenAI-compatible custom providers are accepted as simple tokens so the\n/// launch path can resolve `[providers.<id>]` from the session config (#3965).\n/// This field remains the ONLY place a profile's provider is established:\n/// callers never infer it from `model` (EPIC #2608).\nfn validate_agent_profile_provider(path: &Path, value: &str) -> Result<()> {\n    let trimmed = value.trim();\n    if trimmed.is_empty() {\n        bail!(\"agent profile {} provider cannot be empty\", path.display());","sourceCodeStart":464,"sourceCodeEnd":500,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/fleet/profile.rs#L464-L500","documentation":"validate_agent_profile_model_hint checks the profile's model field with is_model_hint: every character must be ASCII graphic except '=', '\\'' and '\"'. The quote/equals ban exists so API keys and quoted ids cannot ride along inside a profile. The loader trims and drops blank model values first, so this error fires on inner whitespace, quotes, or '=' characters.","triggerScenarios":"model = \"gpt-4o (preview)\" (inner space), model = \"'claude-sonnet-4'\" (quotes pasted from docs), model = \"gpt-4o key=abc\" (equals sign / embedded key material), or any model id containing a non-printable or non-ASCII character.","commonSituations":"Copying a model id that was quoted in documentation or a changelog; accidentally appending provider credentials to the model string; model ids with parenthetical suffixes.","solutions":["Set model to a bare model id with no surrounding quotes, e.g. model = \"gpt-4o\"","Remove any whitespace, '=' or quote characters from the value - keep only visible printable characters","Store credentials in the provider config ([providers.<id>]), never in the profile's model field"],"exampleFix":"# before\nmodel = \"'claude-sonnet-4'\"\n\n# after\nmodel = \"claude-sonnet-4\"","handlingStrategy":"validation","validationCode":"fn is_model_hint(value: &str) -> bool {\n    let t = value.trim();\n    !t.is_empty()\n        && t == value\n        && t.chars().all(|c| c.is_ascii_graphic() && !matches!(c, '=' | '\\'' | '\"'))\n}\n// assert is_model_hint(model) before writing the profile or calling load","typeGuard":"fn is_visible_model_id(s: &str) -> bool {\n    let t = s.trim();\n    !t.is_empty() && t == s\n        && t.chars().all(|c| c.is_ascii_graphic() && !matches!(c, '=' | '\\'' | '\"'))\n}","tryCatchPattern":"match load_agent_profile_file(&path) {\n    Ok(p) => Ok(p),\n    Err(err) if err.to_string().contains(\"visible model id\") => {\n        Err(anyhow!(\"profile {path:?}: model must be a bare id - no quotes, spaces, or '='\"))\n    }\n    Err(err) => Err(err),\n}","preventionTips":["Paste model ids unquoted and never append credentials to them","Reject '=' and quote characters at the input boundary when users author model hints","Keep provider auth in [providers.<id>] config, not in profile model fields"],"tags":["agent-profile","model-id","validation","toml","secrets"],"backgroundTag":"invalid-model-id","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}