{"record":{"id":"18d650e3fe9470f9","repo":"aaif-goose/goose","slug":"http-error-status-response-status","errorCode":null,"errorMessage":"HTTP error! status: ${response.status}","messagePattern":"HTTP error! status: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"documentation/src/utils/mcp-servers.ts","lineNumber":9,"sourceCode":"import type { MCPServer } from \"../types/server\";\n\nconst SERVERS_URL = \"/servers.json\";\n\nexport async function fetchMCPServers(): Promise<MCPServer[]> {\n  try {\n    const response = await fetch(SERVERS_URL);\n    if (!response.ok) {\n      throw new Error(`HTTP error! status: ${response.status}`);\n    }\n    const data = await response.json();\n    return data;\n  } catch (error) {\n    console.error(\"Error fetching MCP servers:\", error);\n    throw error;\n  }\n}\n\nexport async function searchMCPServers(query: string): Promise<MCPServer[]> {\n  const servers = await fetchMCPServers();\n  const normalizedQuery = query.toLowerCase();\n\n  return servers.filter((server) => {\n    const normalizedName = server.name.toLowerCase();\n    const normalizedDescription = server.description.toLowerCase();\n\n    return (","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/documentation/src/utils/mcp-servers.ts#L1-L27","documentation":"Thrown by fetchMCPServers() in the documentation site when the HTTP response for '/servers.json' has a non-ok status (e.g. 404, 500) before response.json() is attempted. The docs site fetches this static JSON to build the MCP server catalog. Any non-2xx status from the dev server or static host aborts catalog rendering because the error is re-thrown after being logged.","triggerScenarios":"await fetchMCPServers() when the static file servers.json is not served at the site root: missing file in the static/public directory, wrong Docusaurus baseUrl so the path resolves to 404, hosting misconfiguration returning 500, or opening the page from a path where the relative '/servers.json' is unreachable.","commonSituations":"Docs PRs that move or rename servers.json without updating the copy step; running the site with a baseUrl sub-path; local dev where the file lives outside the served static dir; CDN/proxy returning 404 for root-relative paths.","solutions":["Verify servers.json exists in the directory the docs server serves at the root (e.g. static/ or public/) and rebuild the site.","Check the site baseUrl config: '/servers.json' is root-relative, so a sub-path baseUrl breaks the URL; compute it from the site config if needed.","Open the URL directly in a browser (http://localhost:3000/servers.json) to confirm the status code and fix the 404/500 source.","If the file is generated (from crates/goose-mcp), re-run the generation step before starting the docs dev server."],"exampleFix":"// before\nconst SERVERS_URL = \"/servers.json\";\nconst response = await fetch(SERVERS_URL);\nif (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);\n\n// after (baseUrl-aware + clearer failure)\nconst SERVERS_URL = `${import.meta.env.BASE_URL ?? '/'}servers.json`.replace(/\\/\\//g, '/');\nconst response = await fetch(SERVERS_URL);\nif (!response.ok) {\n  throw new Error(`Failed to load ${SERVERS_URL}: ${response.status} ${response.statusText}`);\n}","handlingStrategy":"retry","validationCode":"// Pre-check availability before the real fetch\nasync function assertServersJsonReachable(baseUrl = ''): Promise<void> {\n  const head = await fetch(`${baseUrl}/servers.json`, { method: 'HEAD' });\n  if (!head.ok) {\n    throw new Error(`/servers.json unreachable (${head.status}); is the static file deployed?`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const servers = await fetchMCPServers();\n} catch (error) {\n  // Degrade the catalog instead of breaking the docs page\n  console.error('MCP server catalog unavailable', error);\n  return [];\n}","preventionTips":["Keep servers.json in the static/public directory that the docs bundler copies verbatim.","If the site is served under a sub-path, build the URL from the configured baseUrl instead of hardcoding '/servers.json'.","Add a CI check that the deployed site returns 200 for /servers.json."],"tags":["network","http","fetch","documentation","static-assets"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}