aaif-goose/goose · error
HTTP error! status: ${response.status}
Error message
HTTP error! status: ${response.status} What it means
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.
Source
Thrown at documentation/src/utils/mcp-servers.ts:9
import type { MCPServer } from "../types/server";
const SERVERS_URL = "/servers.json";
export async function fetchMCPServers(): Promise<MCPServer[]> {
try {
const response = await fetch(SERVERS_URL);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data;
} catch (error) {
console.error("Error fetching MCP servers:", error);
throw error;
}
}
export async function searchMCPServers(query: string): Promise<MCPServer[]> {
const servers = await fetchMCPServers();
const normalizedQuery = query.toLowerCase();
return servers.filter((server) => {
const normalizedName = server.name.toLowerCase();
const normalizedDescription = server.description.toLowerCase();
return (View on GitHub (pinned to 3810898a74)
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.
Example fix
// before
const SERVERS_URL = "/servers.json";
const response = await fetch(SERVERS_URL);
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
// after (baseUrl-aware + clearer failure)
const SERVERS_URL = `${import.meta.env.BASE_URL ?? '/'}servers.json`.replace(/\/\//g, '/');
const response = await fetch(SERVERS_URL);
if (!response.ok) {
throw new Error(`Failed to load ${SERVERS_URL}: ${response.status} ${response.statusText}`);
} Defensive patterns
Strategy: retry
Validate before calling
// Pre-check availability before the real fetch
async function assertServersJsonReachable(baseUrl = ''): Promise<void> {
const head = await fetch(`${baseUrl}/servers.json`, { method: 'HEAD' });
if (!head.ok) {
throw new Error(`/servers.json unreachable (${head.status}); is the static file deployed?`);
}
} Try / catch
try {
const servers = await fetchMCPServers();
} catch (error) {
// Degrade the catalog instead of breaking the docs page
console.error('MCP server catalog unavailable', error);
return [];
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- GitHub API returned ${response.status}: ${response.statusTex
- Download failed: ${response.status} ${response.statusText}
- Response body is null
- Failed to exchange code: {} - {}
- Failed to exchange code: {} - {}
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/18d650e3fe9470f9.
Report an issue: GitHub.