Hmbown/CodeWhale · error

MCP resource URI ' ' was not advertised by server

Error message

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

What it means

read_resource authorizes the URI against the server's advertised resources and resource templates before reading; a URI matching neither literal nor template is refused locally so the MCP server is never asked for resources it did not expose.

Solutions

  1. Refresh the server's advertised resource list (list_resources) and use a URI from that list or one matching a advertised template.
  2. Check the server name and URI for typos; the exact literal URI must match.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/mcp.rs:4405 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at crates/tui/src/mcp.rs:4405

        }
        prompts
    }

    /// Read a resource from a specific server
    pub async fn read_resource(
        &mut self,
        server_name: &str,
        uri: &str,
    ) -> Result<serde_json::Value> {
        let global_timeouts = self.config.timeouts;
        let conn = self.get_or_connect(server_name).await?;
        let advertised_literal = conn.resources().iter().any(|resource| resource.uri == uri);
        let advertised_template = conn
            .resource_templates()
            .iter()
            .any(|template| resource_uri_matches_template(uri, &template.uri_template));
        if !advertised_literal && !advertised_template {
            anyhow::bail!("MCP resource URI '{uri}' was not advertised by server '{server_name}'");
        }
        let timeout = conn.config().effective_read_timeout(&global_timeouts);
        conn.read_resource(uri, timeout).await
    }

    /// Get a prompt from a specific server
    pub async fn get_prompt(
        &mut self,
        server_name: &str,
        prompt_name: &str,
        arguments: serde_json::Value,
    ) -> Result<serde_json::Value> {
        let global_timeouts = self.config.timeouts;
        let conn = self.get_or_connect(server_name).await?;
        if !conn
            .prompts()
            .iter()
            .any(|prompt| prompt.name == prompt_name)

View on GitHub (pinned to 73e0f67d83)