zed-industries/zed · error · anyhow::Error

Invalid model ID

Error message

Invalid model ID {}

What it means

Validation error in NativeAgentModelSelector::select_model: the provided AgentModelId does not map to any model known to the registry (model_from_id returned None). Usually caused by a stale id from a previous session or provider list.

Solutions

  1. Re-fetch the model list via list_models and select a currently valid id
  2. Update stale UI state that cached model ids from before a provider change
  3. Check that the provider for the id is still installed and enabled
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/agent/src/agent.rs:2468 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-08-20). Data as JSON: /api/errors/0e8f9816095a58ec. Report an issue: GitHub.

Appendix: source

Thrown at crates/agent/src/agent.rs:2505

        // Skill scope qualifier: `/<scope>:<name>`. Checked before the
        // MCP `.` grammar because `:` and `.` are different delimiters
        // — the two namespaces can't collide. Skill names are
        // restricted to `[a-z0-9-]+` (no colons), so the LAST `:` is
        // always the scope/name boundary; using `rsplit_once` lets
        // scope labels (e.g. a worktree root name) themselves contain
        // colons without breaking the parse.
        //
        // An empty scope (`/:<name>`) is the qualified form for a
        // global skill — see `SkillSource::scope_prefix`. The name
        // must be non-empty for the colon to be meaningful.
        if let Some((scope, prompt_name)) = command.rsplit_once(':')
            && !prompt_name.is_empty()
        {
            return Some(Self {
                prompt_name,
                arg_value,
                explicit_server_id: None,
                skill_scope: Some(scope),
            });
        }

        if let Some((server_id, prompt_name)) = command.split_once('.') {
            Some(Self {
                prompt_name,
                arg_value,
                explicit_server_id: Some(server_id),
                skill_scope: None,
            })
        } else {
            Some(Self {
                prompt_name: command,
                arg_value,
                explicit_server_id: None,
                skill_scope: None,
            })
        }

View on GitHub (pinned to 916fc2b8cb)