{"record":{"id":"51236cdc0a26893e","repo":"Hmbown/CodeWhale","slug":"resource-uri-was-not-advertised-by-any-running-mcp-server","errorCode":null,"errorMessage":"resource URI '{}' was not advertised by any running MCP server","messagePattern":"resource URI '(.+?)' was not advertised by any running MCP server","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mcp/src/lib.rs","lineNumber":595,"sourceCode":"                .list_resources()?\n                .iter()\n                .any(|resource| resource.uri == uri)\n            {\n                matches.push(server_name.clone());\n            }\n        }\n\n        match matches.len() {\n            1 => self.read_resource(&matches[0], uri),\n            0 => {\n                // Preserve the pre-standard URI convention for clients whose\n                // server does not implement resources/list.\n                if let Some(server_name) = parse_server_from_uri(uri)\n                    && self.clients.contains_key(&server_name)\n                {\n                    return self.read_resource(&server_name, uri);\n                }\n                bail!(\"resource URI '{uri}' was not advertised by any running MCP server\")\n            }\n            _ => {\n                matches.sort();\n                bail!(\n                    \"resource URI '{uri}' is ambiguous across MCP servers: {}; pass the legacy \\\n                     server parameter to disambiguate\",\n                    matches.join(\", \")\n                )\n            }\n        }\n    }\n\n    /// Generate sandbox state update notices for all registered servers.\n    pub fn update_sandbox_state(&self, sandbox_mode: &str, cwd: &str) -> Result<Vec<Value>> {\n        let mut notices = Vec::new();\n        for server_name in self.configs.keys() {\n            notices.push(json!({\n                \"server_name\": server_name,","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/crates/mcp/src/lib.rs#L577-L613","documentation":"read_resource_by_uri looks up a resource URI among resources advertised by running servers. For a standard (non server-prefixed) URI, if no running server advertised it (and no server-embedded URI matches a running client), the library reports the URI is unknown.","triggerScenarios":"Calling read_resource_by_uri with a URI that no running server advertised via resources/list, or where the embedded server name in the URI does not correspond to a running client.","commonSituations":"Typo in the URI; server that advertised the resource has been stopped/unregistered; resource listing cached before the server started; passing a raw server-prefixed URI when the server is not running.","solutions":["Verify the URI against resources advertised by the running server","Ensure the owning MCP server is running and registered","Re-fetch the resource list after servers start"],"exampleFix":"// before\nmanager.read_resource_by_uri(\"file:///missing.txt\", None)?\n// after\nlet advertised = manager.list_resources()?;\nif advertised.iter().any(|r| r.uri == uri) {\n    manager.read_resource_by_uri(&uri, None)?\n}","handlingStrategy":"validation","validationCode":"if !manager.list_resources()?.iter().any(|r| r.uri == uri) { return Err(\"uri not advertised\"); }","typeGuard":null,"tryCatchPattern":"match manager.read_resource_by_uri(uri, server) { Err(e) if e.to_string().contains(\"was not advertised\") => /* refresh resource list and retry */, other => other }","preventionTips":["Refresh the advertised resource list after server start/stop","Copy URIs from list_resources output rather than typing them","Check server liveness before resource reads"],"tags":["mcp","resource","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}