{"record":{"id":"f148691bf8d189af","repo":"ruvnet/ruflo","slug":"failed-to-fetch-base-servers-response-statustex","errorCode":null,"errorMessage":"Failed to fetch base servers: ${response.statusText}","messagePattern":"Failed to fetch base servers: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ruflo/src/ruvocal/src/lib/stores/mcpServers.ts","lineNumber":171,"sourceCode":"export const allBaseServersEnabled = derived(\n\t[allMcpServers, selectedServerIds],\n\t([$all, $selected]) => {\n\t\tconst baseServers = $all.filter((s) => s.type === \"base\");\n\t\treturn baseServers.length > 0 && baseServers.every((s) => $selected.has(s.id));\n\t}\n);\n\n// Note: Authorization overlay (with user's HF token) for the Hugging Face MCP host\n// is applied server-side when enabled via MCP_FORWARD_HF_USER_TOKEN.\n\n/**\n * Refresh base servers from API and merge with custom servers + WASM server\n */\nexport async function refreshMcpServers() {\n\ttry {\n\t\tconst response = await fetch(`${base}/api/mcp/servers`);\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`Failed to fetch base servers: ${response.statusText}`);\n\t\t}\n\n\t\tconst baseServers: MCPServer[] = await response.json();\n\t\tconst customServers = loadCustomServers();\n\n\t\t// Create WASM server and add to the list\n\t\tconst wasmServer = createWasmServer();\n\n\t\t// Merge base, custom, and WASM servers\n\t\tconst merged = [wasmServer, ...baseServers, ...customServers];\n\t\tallMcpServers.set(merged);\n\n\t\t// Load disabled base servers\n\t\tconst disabledBaseIds = loadDisabledBaseIds();\n\n\t\t// Auto-enable all base servers that aren't explicitly disabled\n\t\t// Plus keep any custom servers that were previously selected\n\t\t// WASM server is auto-enabled by default","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/ruflo/src/ruvocal/src/lib/stores/mcpServers.ts#L153-L189","documentation":"Thrown inside refreshMcpServers(), the client-side Svelte store that merges MCP servers from the app's own API (${base}/api/mcp/servers) with locally-stored custom servers and the WASM server. A non-OK HTTP status aborts the refresh; the surrounding try/catch records the error in store state, so the user sees a stale or empty server list.","triggerScenarios":"Browser fetch to /api/mcp/servers returns non-2xx: 401/403 when the session expired or MCP_FORWARD_HF_USER_TOKEN forwarding rejected the token; 500 when server-side MCP hub configuration (MCP_SERVERS) is broken; 404 after a route change or bad `base` in a reverse-proxy deployment.","commonSituations":"Logged-out or expired-cookie tab refreshing MCP servers; reverse proxy stripping or misrouting /api/mcp/*; server-side MCP hub (Hugging Face MCP host) outage; deploying front and back on different origins without forwarding the path.","solutions":["Reproduce in the browser: open ${base}/api/mcp/servers directly and read the status/body.","401/403: re-login or refresh the session; verify MCP_FORWARD_HF_USER_TOKEN and the user's HF token if server-side overlay auth is enabled.","500: check server logs for the MCP hub error (often the upstream MCP host or MCP_SERVERS env parse).","404/misroute: fix the reverse proxy so /api/mcp/servers reaches the SvelteKit server unchanged.","Reload the page after fixing — refreshMcpServers is called on init and will repopulate the store."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// probe before relying on the store\nconst res = await fetch(`${base}/api/mcp/servers`);\nif (!res.ok) {\n\tthrow new Error(`MCP servers endpoint returned ${res.status}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n\tawait refreshMcpServers();\n} catch (err) {\n\t// store keeps previous allMcpServers value; surface error state to the UI\n\tconsole.error(\"mcp refresh failed\", err);\n}","preventionTips":["Keep the store's previous value on failure so the UI degrades to the last good list.","Show the HTTP status from the network tab when debugging; it distinguishes auth vs server vs routing.","Ensure reverse proxies forward /api/mcp/* and session cookies unchanged."],"tags":["mcp","http","client","store"],"backgroundTag":"http-request-failed","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}