{"record":{"id":"c69d10bd7a218aac","repo":"zed-industries/zed","slug":"invalid-model-id-id","errorCode":null,"errorMessage":"invalid model id {id}","messagePattern":"invalid model id (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/bedrock/src/models.rs","lineNumber":268,"sourceCode":"            Ok(Self::ClaudeOpus4_7)\n        } else if id.starts_with(\"claude-opus-4-6\") {\n            Ok(Self::ClaudeOpus4_6)\n        } else if id.starts_with(\"claude-opus-4-5\") {\n            Ok(Self::ClaudeOpus4_5)\n        } else if id.starts_with(\"claude-opus-4-1\") {\n            Ok(Self::ClaudeOpus4_1)\n        } else if id.starts_with(\"claude-sonnet-5\") {\n            Ok(Self::ClaudeSonnet5)\n        } else if id.starts_with(\"claude-sonnet-4-6\") {\n            Ok(Self::ClaudeSonnet4_6)\n        } else if id.starts_with(\"claude-sonnet-4-5\") {\n            Ok(Self::ClaudeSonnet4_5)\n        } else if id.starts_with(\"claude-sonnet-4\") {\n            Ok(Self::ClaudeSonnet4)\n        } else if id.starts_with(\"claude-haiku-4-5\") {\n            Ok(Self::ClaudeHaiku4_5)\n        } else {\n            anyhow::bail!(\"invalid model id {id}\");\n        }\n    }\n\n    pub fn id(&self) -> &str {\n        match self {\n            Self::ClaudeFable5 => \"claude-fable-5\",\n            Self::ClaudeOpus5 => \"claude-opus-5\",\n            Self::ClaudeOpus4_8 => \"claude-opus-4-8\",\n            Self::ClaudeOpus4_7 => \"claude-opus-4-7\",\n            Self::ClaudeOpus4_6 => \"claude-opus-4-6\",\n            Self::ClaudeOpus4_5 => \"claude-opus-4-5\",\n            Self::ClaudeOpus4_1 => \"claude-opus-4-1\",\n            Self::ClaudeSonnet5 => \"claude-sonnet-5\",\n            Self::ClaudeSonnet4_6 => \"claude-sonnet-4-6\",\n            Self::ClaudeSonnet4_5 => \"claude-sonnet-4-5\",\n            Self::ClaudeSonnet4 => \"claude-sonnet-4\",\n            Self::ClaudeHaiku4_5 => \"claude-haiku-4-5\",\n            Self::Llama4Scout17B => \"llama-4-scout-17b\",","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/bedrock/src/models.rs#L250-L286","documentation":"`ConverseModel::from_id` maps a model id string to a Bedrock model variant, but only recognizes `claude-*` ids via `starts_with` prefixes (claude-fable-5, claude-opus-5, claude-opus-4-x, claude-sonnet-5/4-x, claude-haiku-4-5). Anything else — ARNs (`arn:aws:bedrock:...`), inference-profile ids (`us.anthropic.claude-...`), or non-Claude ids like `llama-4-scout-17b` even though the enum supports them — bails with 'invalid model id'.","triggerScenarios":"Calling `ConverseModel::from_id` with: a full Bedrock model ARN; a regional/global inference profile id such as `us.anthropic.claude-sonnet-4-5-...` (does not start with `claude-`); a non-Claude id like `llama-4-scout-17b` or `gemma-3-12b`; a typo like `claude-sonet-4-5`. Commonly reached from Zed settings listing Bedrock `available_models`.","commonSituations":"Copying model identifiers from the AWS Bedrock console (which shows profile ids like `us.anthropic...`) into Zed settings; configuring Llama/Nova models through a path that funnels into `from_id`; version-suffix mismatches; settings written for an older/newer Zed with different supported ids.","solutions":["Use the bare prefix form the parser accepts, e.g. `claude-sonnet-4-5` or `claude-sonnet-4-5-20250929` (suffix after the matched prefix is fine).","For non-Claude or profile-id models, configure them via the `custom` model entry in Bedrock settings (name/max_tokens fields) instead of relying on `from_id`.","Double-check spelling — the matcher is literal `starts_with`, so `anthropic.claude-...` fails.","If embedding in your own code, validate ids against `from_id` at config-load time and reject early with the list of valid prefixes."],"exampleFix":"// before: full Bedrock inference-profile id or ARN fails\nlet model = ConverseModel::from_id(\"us.anthropic.claude-sonnet-4-5-20241022-v1:0\")?; // invalid model id\n\n// after: bare id prefix, or route exotic ids through Custom\nlet model = ConverseModel::from_id(\"claude-sonnet-4-5\")?;\n// or, for models from_id does not know:\nlet model = ConverseModel::Custom { name: profile_id.into(), max_tokens: 8192, display_name: None, max_output_tokens: None, default_temperature: None, cache_configuration: None };","handlingStrategy":"validation","validationCode":"// Validate at settings-load time, not on first request\nfor id in &configured_ids {\n    if let Err(err) = ConverseModel::from_id(id) {\n        return Err(anyhow!(\"bedrock settings: {err:#}; use a claude-* prefix id or a custom entry\"));\n    }\n}","typeGuard":"fn is_known_converse_model(id: &str) -> bool {\n    [\n        \"claude-fable-5\", \"claude-opus-5\", \"claude-opus-4-8\", \"claude-opus-4-7\",\n        \"claude-opus-4-6\", \"claude-opus-4-5\", \"claude-opus-4-1\", \"claude-sonnet-5\",\n        \"claude-sonnet-4-6\", \"claude-sonnet-4-5\", \"claude-sonnet-4\", \"claude-haiku-4-5\",\n    ]\n    .iter()\n    .any(|prefix| id.starts_with(prefix))\n}","tryCatchPattern":"let model = match ConverseModel::from_id(id) {\n    Ok(model) => model,\n    Err(_) if is_custom_config(id) => ConverseModel::Custom { name: id.into(), max_tokens: 8192, display_name: None, max_output_tokens: None, default_temperature: None, cache_configuration: None },\n    Err(err) => return Err(err),\n};","preventionTips":["Use bare `claude-*` ids; never paste ARNs or `us.anthropic.*` profile ids where `from_id` runs.","Route non-Claude or profile-id models through the Custom entry.","Test model ids against `from_id` when loading config so bad entries fail fast with context."],"tags":["bedrock","model-id","anthropic","settings","aws"],"backgroundTag":"invalid-model-id","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}