{"record":{"id":"bbe380013053ce8a","repo":"zed-industries/zed","slug":"invalid-model-id-id-deepseek","errorCode":null,"errorMessage":"invalid model id {id}","messagePattern":"invalid model id (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/deepseek/src/deepseek.rs","lineNumber":77,"sourceCode":"    Custom {\n        name: String,\n        /// The name displayed in the UI, such as in the agent panel model dropdown menu.\n        display_name: Option<String>,\n        max_tokens: u64,\n        max_output_tokens: Option<u64>,\n    },\n}\n\nimpl Model {\n    pub fn default_fast() -> Self {\n        Model::V4_1Flash\n    }\n\n    pub fn from_id(id: &str) -> Result<Self> {\n        match id {\n            \"deepseek-flash\" => Ok(Self::V4_1Flash),\n            \"deepseek-v4-pro\" => Ok(Self::V4Pro),\n            _ => anyhow::bail!(\"invalid model id {id}\"),\n        }\n    }\n\n    pub fn id(&self) -> &str {\n        match self {\n            Self::V4_1Flash => \"deepseek-flash\",\n            Self::V4Pro => \"deepseek-v4-pro\",\n            Self::Custom { name, .. } => name,\n        }\n    }\n\n    pub fn display_name(&self) -> &str {\n        match self {\n            Self::V4_1Flash => \"DeepSeek V4.1 Flash\",\n            Self::V4Pro => \"DeepSeek V4 Pro\",\n            Self::Custom {\n                name, display_name, ..\n            } => display_name.as_ref().unwrap_or(name).as_str(),","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/deepseek/src/deepseek.rs#L59-L95","documentation":"`DeepSeekModel::from_id` parses a model id string from configuration or API responses into the enum. Only the listed ids ('deepseek-flash', 'deepseek-v4-pro') are recognized; anything else returns an `anyhow` error 'invalid model id {id}'. This validates user/model configuration before requests are made.","triggerScenarios":"Calling `DeepSeekModel::from_id` with a model id that isn't in the match list — e.g. a mistyped id in settings, an id from a newer/older DeepSeek API, or a custom deployment name.","commonSituations":"Typo in the `model` field of DeepSeek provider settings; DeepSeek releasing/renaming models so stored ids no longer match; copying an OpenAI-style id into DeepSeek settings.","solutions":["Set the model id in settings to exactly 'deepseek-flash' or 'deepseek-v4-pro'.","Check the provider's available-models list (or `DeepSeekModel::id()` values) and update the configuration.","If a new DeepSeek model exists, add a match arm for it in `from_id` (and `id`)."],"exampleFix":"// before (settings.json)\n\"model\": \"deepseek-chat\"\n// after\n\"model\": \"deepseek-v4-pro\"","handlingStrategy":"validation","validationCode":"// validate before calling from_id\nconst DEEPSEEK_MODELS: &[&str] = &[\"deepseek-flash\", \"deepseek-v4-pro\"];\nif !DEEPSEEK_MODELS.contains(&model_id) {\n    return Err(anyhow!(\"unknown DeepSeek model: {model_id}\"));\n}\nlet model = DeepSeekModel::from_id(model_id)?;","typeGuard":"fn is_valid_deepseek_id(id: &str) -> bool {\n    matches!(id, \"deepseek-flash\" | \"deepseek-v4-pro\")\n}","tryCatchPattern":"match DeepSeekModel::from_id(&id) {\n    Ok(m) => m,\n    Err(e) => { log::error!(\"{e:#}\"); return default_model(); }\n}","preventionTips":["Pick model ids from the provider's settings UI/list rather than typing them.","Keep model configuration validated on startup with a clear error.","After DeepSeek renames models, update both settings and from_id match arms."],"tags":["deepseek","model-id","configuration","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-09-19T19:09:50.599Z","contentChangedAt":"2026-09-19T19:09:50.599Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}