microsoft/autogen · error · Error
Failed to get MCP resource
Error message
Failed to get MCP resource
What it means
Last-resort wrapper raised when SearchClient initialization throws anything that is not ResourceNotFoundError or HttpResponseError — for example DNS resolution failure, SSL certificate error, missing required constructor argument, or a TypeError from a wrong credential type reaching the SDK. The original exception is chained as __cause__.
Source
Thrown at python/packages/autogen-studio/frontend/src/components/views/mcp/api.ts:139
throw new Error(data.message || "Failed to list MCP resources");
}
return data;
}
async getResource(serverParams: McpServerParams, uri: string) {
const response = await fetch(`${this.getBaseUrl()}/mcp/resources/get`, {
method: "POST",
headers: this.getHeaders(),
body: JSON.stringify({
server_params: serverParams,
uri: uri,
}),
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.message || "Failed to get MCP resource");
}
return data;
}
async listPrompts(serverParams: McpServerParams) {
const response = await fetch(`${this.getBaseUrl()}/mcp/prompts/list`, {
method: "POST",
headers: this.getHeaders(),
body: JSON.stringify({ server_params: serverParams }),
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.message || "Failed to list MCP prompts");
}
return data;View on GitHub (pinned to 027ecf0a37)
Solutions
- Inspect e.__cause__ — the true constructor error determines the fix.
- Normalize the endpoint to a full URL: "https://<service>.search.windows.net".
- Validate all required config fields (endpoint, index_name, credential) are non-None and correctly typed before constructing the tool.
- For TLS/proxy issues, configure the corporate CA bundle or exclude the search endpoint from interception.
Example fix
# before config = AzureAISearchConfig(endpoint="mysvc.search.windows.net", ...) # no scheme # after config = AzureAISearchConfig(endpoint="https://mysvc.search.windows.net", ...)
Defensive patterns
Strategy: try-catch
Validate before calling
from urllib.parse import urlparse
def endpoint_well_formed(endpoint: str) -> bool:
p = urlparse(endpoint)
return p.scheme == "https" and bool(p.netloc) Try / catch
try:
results = await tool.run(query)
except ValueError as e:
cause = e.__cause__
if "Unexpected error initializing" in str(e) and cause is not None:
raise RuntimeError(f"Search client init failed: {cause!r}") from e
raise Prevention
- Validate the endpoint URL (scheme + host) in your settings model.
- Always inspect e.__cause__ for this wrapper — the real error is never in the wrapper text.
When it happens
Trigger: Calling _get_client/run() with a malformed endpoint (e.g. missing https:// scheme, plain hostname that fails DNS), or passing config values whose types the SDK rejects, producing an unexpected exception type inside the constructor.
Common situations: Endpoint configured without scheme ('mysvc.search.windows.net' instead of 'https://mysvc.search.windows.net'); corporate proxies/SSL interception breaking TLS; offline environments where DNS fails; None values slipping into config fields.
Related errors
- Failed to list MCP resources
- Failed to get login URL
- Authentication failed
- ${componentType} template ${templateId} not found
- Failed to fetch gallery
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/c2096b1596cd9420.
Report an issue: GitHub.