Hmbown/CodeWhale · error

resource URI ' ' is ambiguous across MCP servers: ; pass…

Error message

resource URI '{}' is ambiguous across MCP servers: {}; pass the legacy server parameter to disambiguate

What it means

Multiple running MCP servers advertise the same resource URI, so resolving it by URI alone is ambiguous. The library refuses to guess and asks the caller to pass the legacy server parameter to disambiguate.

Solutions

  1. Pass the server name via the legacy server parameter to pick one
  2. Stop or unregister one of the servers advertising the duplicate URI
  3. Change one server's resource root so URIs no longer collide

Example fix

// before
manager.read_resource_by_uri("file:///ws/notes.md", None)?
// after
manager.read_resource_by_uri("file:///ws/notes.md", Some("docs"))?
Defensive patterns

Strategy: validation

Validate before calling

let matches: Vec<_> = manager.list_resources()?.iter().filter(|r| r.uri == uri).collect(); if matches.len() > 1 { /* need server param */ }

Try / catch

match manager.read_resource_by_uri(uri, None) { Err(e) if e.to_string().contains("is ambiguous") => /* parse server names from message and retry with Some(server) */, other => other }

Prevention

When it happens

Trigger: Calling read_resource_by_uri(uri, None) where two or more running servers advertise the identical URI via resources/list.

Common situations: Two servers mounting the same file:// path or exposing overlapping resources; duplicated server configs pointing at the same workspace.

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 Hmbown/CodeWhale@433685b202 (2026-09-15). Data as JSON: /api/errors/14d71d53edbd07c6. Report an issue: GitHub.

Appendix: source

Thrown at crates/mcp/src/lib.rs:599

                matches.push(server_name.clone());
            }
        }

        match matches.len() {
            1 => self.read_resource(&matches[0], uri),
            0 => {
                // Preserve the pre-standard URI convention for clients whose
                // server does not implement resources/list.
                if let Some(server_name) = parse_server_from_uri(uri)
                    && self.clients.contains_key(&server_name)
                {
                    return self.read_resource(&server_name, uri);
                }
                bail!("resource URI '{uri}' was not advertised by any running MCP server")
            }
            _ => {
                matches.sort();
                bail!(
                    "resource URI '{uri}' is ambiguous across MCP servers: {}; pass the legacy \
                     server parameter to disambiguate",
                    matches.join(", ")
                )
            }
        }
    }

    /// Generate sandbox state update notices for all registered servers.
    pub fn update_sandbox_state(&self, sandbox_mode: &str, cwd: &str) -> Result<Vec<Value>> {
        let mut notices = Vec::new();
        for server_name in self.configs.keys() {
            notices.push(json!({
                "server_name": server_name,
                "method": "codex/sandbox-state/update",
                "params": {
                    "sandbox_mode": sandbox_mode,
                    "cwd": cwd

View on GitHub (pinned to 433685b202)