{"record":{"id":"836b065195dac1fd","repo":"Hmbown/CodeWhale","slug":"model-cannot-be-empty","errorCode":null,"errorMessage":"model cannot be empty","messagePattern":"model cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/config.rs","lineNumber":11177,"sourceCode":"            \"config_path\": config_path.display().to_string(),\n        }),\n    );\n    codewhale_config::scrub_plaintext_api_keys_from_config_backup(&config_path)?;\n\n    Ok(SavedCredential::ConfigFile(config_path))\n}\n\n/// Persist a default model for `provider` via the comment-preserving config\n/// path used by guided provider setup (#3875). DeepSeek writes root\n/// `default_text_model`; other hosted providers write `[providers.<name>] model`.\npub(crate) fn save_provider_model_for_identity(\n    identity: &ProviderIdentity,\n    _route_config: &Config,\n    model: &str,\n) -> Result<PathBuf> {\n    let provider = identity.provider;\n    let model = model.trim();\n    anyhow::ensure!(!model.is_empty(), \"model cannot be empty\");\n\n    let config_path =\n        try_default_config_path().context(\"Failed to resolve config path for provider model.\")?;\n    ensure_parent_dir(&config_path)?;\n\n    let is_legacy_literal_custom = provider == ApiProvider::Custom\n        && identity.key.trim() == ApiProvider::Custom.as_str()\n        && identity.persisted_id().is_none();\n    if matches!(provider, ApiProvider::Deepseek | ApiProvider::DeepseekCN)\n        || is_legacy_literal_custom\n    {\n        crate::config_persistence::mutate_config_document(&config_path, |doc| {\n            crate::config_persistence::set_document_value(doc, &[\"default_text_model\"], model)\n        })\n        .with_context(|| format!(\"Failed to write config to {}\", config_path.display()))?;\n        return Ok(config_path);\n    }\n","sourceCodeStart":11159,"sourceCodeEnd":11195,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/config.rs#L11159-L11195","documentation":"Error \"model cannot be empty\" thrown in Hmbown/CodeWhale.","triggerScenarios":"Thrown at crates/tui/src/config.rs:11177 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"}