{"record":{"id":"58db8f2a4316ead4","repo":"zed-industries/zed","slug":"invalid-model-id-invalid-id","errorCode":null,"errorMessage":"invalid model id '{invalid_id}'","messagePattern":"invalid model id '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/open_ai/src/open_ai.rs","lineNumber":155,"sourceCode":"            \"gpt-4o-mini\" => Ok(Self::FourOmniMini),\n            \"o3\" => Ok(Self::O3),\n            \"gpt-5\" => Ok(Self::Five),\n            \"gpt-5-mini\" => Ok(Self::FiveMini),\n            \"gpt-5-nano\" => Ok(Self::FiveNano),\n            \"gpt-5.1\" => Ok(Self::FivePointOne),\n            \"gpt-5.2\" => Ok(Self::FivePointTwo),\n            \"gpt-5.3-codex\" => Ok(Self::FivePointThreeCodex),\n            \"gpt-5.4-nano\" => Ok(Self::FivePointFourNano),\n            \"gpt-5.4-mini\" => Ok(Self::FivePointFourMini),\n            \"gpt-5.4\" => Ok(Self::FivePointFour),\n            \"gpt-5.4-pro\" => Ok(Self::FivePointFourPro),\n            \"gpt-5.5\" => Ok(Self::FivePointFive),\n            \"gpt-5.5-pro\" => Ok(Self::FivePointFivePro),\n            \"gpt-5.6-sol\" => Ok(Self::FivePointSixSol),\n            \"gpt-5.6-terra\" => Ok(Self::FivePointSixTerra),\n            \"gpt-5.6-luna\" => Ok(Self::FivePointSixLuna),\n            \"gpt-6-astra\" => Ok(Self::SixAstra),\n            invalid_id => anyhow::bail!(\"invalid model id '{invalid_id}'\"),\n        }\n    }\n\n    pub fn id(&self) -> &str {\n        match self {\n            Self::Four => \"gpt-4\",\n            Self::FourOmniMini => \"gpt-4o-mini\",\n            Self::O3 => \"o3\",\n            Self::Five => \"gpt-5\",\n            Self::FiveMini => \"gpt-5-mini\",\n            Self::FiveNano => \"gpt-5-nano\",\n            Self::FivePointOne => \"gpt-5.1\",\n            Self::FivePointTwo => \"gpt-5.2\",\n            Self::FivePointThreeCodex => \"gpt-5.3-codex\",\n            Self::FivePointFourNano => \"gpt-5.4-nano\",\n            Self::FivePointFourMini => \"gpt-5.4-mini\",\n            Self::FivePointFour => \"gpt-5.4\",\n            Self::FivePointFourPro => \"gpt-5.4-pro\",","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/open_ai/src/open_ai.rs#L137-L173","documentation":"`open_ai::Model::from_id` maps a model id string to the enum's variants; unrecognized ids bail with 'invalid model id {invalid_id}'. It guards against configuring or receiving model names that this OpenAI provider version doesn't know how to handle.","triggerScenarios":"Calling `Model::from_id` with an id not in the match list (e.g. 'gpt-4o', 'o3', a fine-tuned or Azure deployment name) when constructing requests or reading provider settings.","commonSituations":"Outdated Zed version encountering newer OpenAI model ids returned by the API; users typing unofficial/custom deployment names in the `model` setting; ids from API version mismatches.","solutions":["Use one of the supported ids (e.g. 'gpt-4', 'gpt-5.5', 'gpt-6-astra', etc.) in the model setting.","Update Zed (or the open_ai crate) to a version whose from_id recognizes your model id.","If you own the code, add a match arm for the new id plus its `id()` counterpart.","For custom deployments, map them to a supported variant or use an available_models listing to validate before from_id."],"exampleFix":"// before\n\"model\": \"gpt-4o-mini\"\n// after\n\"model\": \"gpt-5.5\"","handlingStrategy":"validation","validationCode":"// validate the configured model id before requests\nmatch open_ai::Model::from_id(&settings.model) {\n    Ok(model) => model,\n    Err(e) => { eprintln!(\"{e}; falling back to default\"); open_ai::Model::default() }\n}","typeGuard":"fn is_supported_openai_id(id: &str) -> bool {\n    [\n        \"gpt-4\", \"gpt-5.5\", \"gpt-5.5-pro\", \"gpt-5.6-sol\",\n        \"gpt-5.6-terra\", \"gpt-5.6-luna\", \"gpt-6-astra\",\n    ].contains(&id)\n}","tryCatchPattern":"let model = Model::from_id(&id).unwrap_or_else(|_| {\n    log::warn!(\"unsupported model id '{id}', using default\");\n    Model::default()\n});","preventionTips":["Select model ids from the UI's available-models list instead of free typing.","Keep Zed updated so newly released OpenAI ids are recognized.","On from_id failure, surface the supported ids in the error message to users.","For custom deployments, map them to supported variants before parsing."],"tags":["openai","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"}