Hmbown/CodeWhale · error

resource URI ' ' was not advertised by any running MCP…

Error message

resource URI '{uri}' was not advertised by any running MCP server

What it means

read_resource_by_uri looks up which running MCP server advertised a resource URI. If no server advertised it — and the URI does not embed a recognizable server name for a connected server — the manager rejects the read rather than guessing. It fails closed for unknown or stale resource URIs.

Solutions

  1. Refresh the resource catalog (list resources from running servers) and use a URI that is currently advertised.
  2. Check the URI spelling/scheme against what the server actually advertises.
  3. If the URI embeds a server name (legacy form), ensure that server is connected/running before the read.
  4. If you know the owning server, use read_resource(server_name, uri) directly instead of URI-only resolution.

Example fix

// before
manager.read_resource_by_uri("file:///old/logs.txt")  // server restarted, URI gone
// after
let uri = current_catalog().resolve("logs.txt")?;
manager.read_resource_by_uri(&uri)
Defensive patterns

Strategy: validation

Validate before calling

fn uri_is_advertised(manager: &McpManager, uri: &str) -> bool {
    manager.clients.keys().any(|s|
        manager.list_resources(s).map(|rs| rs.iter().any(|r| r.uri == uri)).unwrap_or(false))
}

Try / catch

match manager.read_resource_by_uri(uri) {
    Err(e) if e.to_string().contains("was not advertised") => {
        manager.refresh_catalog()?; // server may have restarted
        manager.read_resource_by_uri(uri)
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling read_resource_by_uri(uri) where the URI matches no server's advertised resource list, and parse_server_from_uri either cannot extract a server name or the extracted server is not among the running clients.

Common situations: Using a resource URI captured from a previous session where the server is no longer running; typo in the URI scheme/path; server was restarted and advertises a different URI set; resource was removed from the server's list since caching.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/36e4d1f9f743a9fe. Report an issue: GitHub.

Appendix: source

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

                .list_resources()?
                .iter()
                .any(|resource| resource.uri == uri)
            {
                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,

View on GitHub (pinned to 73e0f67d83)