{"record":{"id":"a38f1e289a15c5ea","repo":"sigoden/aichat","slug":"unsupported-model-name","errorCode":null,"errorMessage":"Unsupported model '{name}'","messagePattern":"Unsupported model '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/client/macros.rs","lineNumber":243,"sourceCode":"#[macro_export]\nmacro_rules! config_get_fn {\n    ($field_name:ident, $fn_name:ident) => {\n        fn $fn_name(&self) -> anyhow::Result<String> {\n            let env_prefix = Self::name(&self.config);\n            let env_name =\n                format!(\"{}_{}\", env_prefix, stringify!($field_name)).to_ascii_uppercase();\n            std::env::var(&env_name)\n                .ok()\n                .or_else(|| self.config.$field_name.clone())\n                .ok_or_else(|| anyhow::anyhow!(\"Miss '{}'\", stringify!($field_name)))\n        }\n    };\n}\n\n#[macro_export]\nmacro_rules! unsupported_model {\n    ($name:expr) => {\n        anyhow::bail!(\"Unsupported model '{}'\", $name)\n    };\n}\n","sourceCodeStart":225,"sourceCodeEnd":246,"githubUrl":"https://github.com/sigoden/aichat/blob/82976d349ad97ac9aae0655ad631dace5e2a6385/src/client/macros.rs#L225-L246","documentation":"Emitted by the `unsupported_model!` macro (src/client/macros.rs:243), which bails with \"Unsupported model '<name>'\". It signals that a model name given to the library does not map to any client/model combination the library knows how to route.","triggerScenarios":"Passing a model identifier to a client/API entry point whose name doesn't correspond to a registered model for any client — typically when dispatching on model name fails in macros that select the client by model.","commonSituations":"Typo in the model name; model exists only on a newer provider version; using a model alias not present in the client's configured models list; mixing model names across clients (e.g. OpenAI name on an Ollama client).","solutions":["Check the model name spelling against the provider's model list (/v1/models).","Ensure the model is included in the client's configured models (set_client_models_config) so routing can find it.","Prefix the model with the client name (client:model) if the library supports that form.","Upgrade the library if the model was added in a newer provider catalog."],"exampleFix":"// before\nlet model = \"gpt4o\"; // typo\n// after\nlet model = \"gpt-4o\";","handlingStrategy":"validation","validationCode":"// ensure the model is configured/routable before use\nlet configured: Vec<String> = config.clients.iter().flat_map(|c| c.models.iter().map(|m| m.name.clone())).collect();\nif !configured.contains(&model.to_string()) {\n    anyhow::bail!(\"model '{}' not configured\", model);\n}","typeGuard":"fn model_is_configured(model: &str, config: &Config) -> bool {\n    config.clients.iter().any(|c| c.models.iter().any(|m| m.name == model))\n}","tryCatchPattern":"match run_with_model(model).await {\n    Err(e) if e.to_string().starts_with(\"Unsupported model\") => {\n        eprintln!(\"'{}' unknown; run fetch_models or fix the name\", model)\n    }\n    other => other,\n}","preventionTips":["Verify model names against the provider's /v1/models list.","Add models to client config during setup so routing can find them.","Use client:model qualified ids when ambiguous.","Watch for typo-prone names (gpt4o vs gpt-4o)."],"tags":["model-routing","invalid-value","rust"],"backgroundTag":"invalid-argument-value","analyzedSha":"82976d349ad97ac9aae0655ad631dace5e2a6385","analyzedAt":"2026-09-09T18:33:06.139Z","contentChangedAt":"2026-09-09T18:33:06.139Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}