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

Expected exactly one context server configuration

Error message

Expected exactly one context server configuration

What it means

Error "Expected exactly one context server configuration" thrown in zed-industries/zed.

Source

Thrown at crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs:357

fn parse_http_input(
    text: &str,
) -> Result<(
    ContextServerId,
    String,
    HashMap<String, String>,
    Option<OAuthClientSettings>,
)> {
    #[derive(Deserialize)]
    struct Temp {
        url: String,
        #[serde(default)]
        headers: HashMap<String, String>,
        #[serde(default)]
        oauth: Option<OAuthClientSettings>,
    }
    let value: HashMap<String, Temp> = serde_json_lenient::from_str(text)?;
    if value.len() != 1 {
        anyhow::bail!("Expected exactly one context server configuration");
    }

    let (key, value) = value.into_iter().next().unwrap();

    Ok((
        ContextServerId(key.into()),
        value.url,
        value.headers,
        value.oauth,
    ))
}

fn resolve_context_server_extension(
    id: ContextServerId,
    worktree_store: Entity<WorktreeStore>,
    cx: &mut App,
) -> Task<Option<ConfigurationTarget>> {
    let registry = ContextServerDescriptorRegistry::default_global(cx).read(cx);

View on GitHub (pinned to bc538def45)

When it happens

Trigger: Thrown at crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs:357 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/c09134f2b29b51f6. Report an issue: GitHub.