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

Unknown settings category: {}

Error message

Unknown settings category: {}

What it means

Thrown by the v0.1.0 settings host binding when an extension calls get_settings with a category string that is not "language" or "lsp". The v0.1.0 WIT surface only exposes those two categories; every other string falls into the wildcard match arm and bails. The host bindings are selected by the extension_api_version declared in extension.toml, so a newer-category call on an old-declared extension lands here.

Source

Thrown at crates/extension_host/src/wasm_host/wit/since_v0_1_0.rs:476

                    "language" => {
                        let key = key.map(|k| LanguageName::new(&k));
                        let settings = AllLanguageSettings::get(location, cx).language(
                            location,
                            key.as_ref(),
                            cx,
                        );
                        Ok(serde_json::to_string(&settings::LanguageSettings {
                            tab_size: settings.tab_size,
                        })?)
                    }
                    "lsp" => {
                        let settings = key
                            .and_then(|key| {
                                ProjectSettings::get(location, cx)
                                    .lsp
                                    .get(&::lsp::LanguageServerName(key.into()))
                            })
                            .cloned()
                            .unwrap_or_default();
                        Ok(serde_json::to_string(&settings::LspSettings {
                            binary: settings.binary.map(|binary| settings::BinarySettings {
                                path: binary.path,
                                arguments: binary.arguments,
                            }),
                            settings: settings.settings,
                            initialization_options: settings.initialization_options,
                        })?)
                    }
                    _ => {
                        bail!("Unknown settings category: {}", category);
                    }
                })
            }
            .boxed_local()
        })
        .await

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Use only "language" or "lsp" as the category on the v0.1.0 API
  2. If you need "context_servers", bump extension_api_version in extension.toml to a version whose host bindings support it
  3. Check for typos/case: the match is exact and case-sensitive

Example fix

// before
let s = get_settings(None, "context_servers".into(), Some(key))?; // Unknown settings category

// after
let s = get_settings(None, "lsp".into(), Some("rust-analyzer".into()))?;
// or bump `extension_api_version` in extension.toml to unlock "context_servers"
Defensive patterns

Strategy: validation

Validate before calling

// before calling get_settings on the v0.1.0 API
const SUPPORTED_CATEGORIES: &[&str] = &["language", "lsp"];
if !SUPPORTED_CATEGORIES.contains(&category.as_str()) {
    return Err(format!("category '{category}' not available on extension API v0.1.0"));
}

Type guard

fn is_supported_category_v0_1_0(category: &str) -> bool {
    matches!(category, "language" | "lsp")
}

Try / catch

match get_settings(None, category, key) {
    Ok(json) => { /* deserialize */ }
    Err(e) if e.starts_with("Unknown settings category") => { /* degrade with defaults */ }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: get_settings(location, category, key) with category not equal to "language" or "lsp" — e.g. "context_servers", "project", "theme", or a typo like "languages".

Common situations: Extension code copy-pasted from a newer extension that queries context-server settings, a typo in the category literal, or an extension that bumped its Rust zed_extension_api crate without bumping extension_api_version in extension.toml.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20). Data as JSON: /api/errors/993a5add9352723f. Report an issue: GitHub.