{"record":{"id":"6c362b97db48aa8d","repo":"mastra-ai/mastra","slug":"failed-to-fetch-servers-from-registry-servers-ur","errorCode":null,"errorMessage":"Failed to fetch servers from ${registry.servers_url}: ${response.statusText}","messagePattern":"Failed to fetch servers from (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mcp-registry-registry/src/registry/fetch-servers.ts","lineNumber":26,"sourceCode":"  try {\n    // Find the registry in our registry data\n    const registry = registryData.registries.find(r => r.id === registryId);\n\n    if (!registry) {\n      throw new Error(`Registry with ID \"${registryId}\" not found.`);\n    }\n\n    if (!registry.servers_url) {\n      throw new Error(`Registry \"${registry.name}\" does not have a servers endpoint.`);\n    }\n\n    console.info(`Fetching servers from ${registry.name} at ${registry.servers_url}`);\n\n    // Fetch the servers from the registry's servers_url\n    const response = await fetch(registry.servers_url);\n\n    if (!response.ok) {\n      throw new Error(`Failed to fetch servers from ${registry.servers_url}: ${response.statusText}`);\n    }\n\n    const data = (await response.json()) as unknown;\n\n    // If the registry has a custom post-processing function, use it\n    if (registry.postProcessServers) {\n      console.info(`Using custom post-processor for ${registry.name}`);\n      return registry.postProcessServers(data);\n    }\n\n    throw new Error(`No post-processor found for registry ${registry.name}`);\n  } catch (error) {\n    console.error('Error fetching servers:', error);\n    throw error;\n  }\n}\n\n/**","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/mcp-registry-registry/src/registry/fetch-servers.ts#L8-L44","documentation":"After fetching the registry's servers_url, the library checks `response.ok`. Any non-2xx HTTP status (404, 500, 401, etc.) causes this error, with the statusText embedded in the message. It indicates the remote registry endpoint was reachable but rejected or failed the request.","triggerScenarios":"fetchServersFromRegistry performs `fetch(registry.servers_url)` and the server responds with a non-OK HTTP status — e.g. wrong URL path, registry server down, auth required, rate limiting.","commonSituations":"Registry endpoint URL is stale or mistyped; remote registry service is down or returning 5xx; endpoint requires authentication headers that are not being sent; corporate proxy/firewall returning error pages.","solutions":["Check response.statusText in the message to identify the HTTP failure (404 = wrong URL, 401/403 = auth, 5xx = server issue)","Verify `servers_url` is correct and reachable (curl it directly)","If the endpoint requires auth, ensure the registry is configured to send credentials/headers","Retry later if the remote registry is temporarily down"],"exampleFix":"// before\nregistry: { name: 'acme', servers_url: 'https://acme.example.com/mcp' }\n// after (verify/fix URL and add auth if needed)\nregistry: { name: 'acme', servers_url: 'https://acme.example.com/api/v1/mcp/servers', headers: { Authorization: `Bearer ${token}` } }","handlingStrategy":"retry","validationCode":"const res = await fetch(registry.servers_url, { method: 'HEAD' });\nif (!res.ok) console.warn(`Registry endpoint unhealthy: ${res.status} ${res.statusText}`);","typeGuard":null,"tryCatchPattern":"try {\n  await registryManager.fetchServersFromRegistry({ registryId });\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Failed to fetch servers')) {\n    await new Promise(r => setTimeout(r, backoffMs));\n    // retry with exponential backoff, capped attempts\n  } else throw err;\n}","preventionTips":["Curl/HEAD-check registry servers_url after config changes","Monitor registry endpoint health (5xx rates)","Send required auth headers for protected endpoints","Use pinned, versioned registry URLs instead of ad-hoc paths"],"tags":["network","http","mcp"],"backgroundTag":"http-request-failed","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}