{"record":{"id":"bf431365ef2355b0","repo":"wavetermdev/waveterm","slug":"failed-to-fetch-config-configresponse-statustex","errorCode":null,"errorMessage":"Failed to fetch config: ${configResponse.statusText}","messagePattern":"Failed to fetch config: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/builder/tabs/builder-configdatatab.tsx","lineNumber":98,"sourceCode":"    const isRunning = builderStatus?.status === \"running\" && builderStatus?.port && builderStatus.port !== 0;\n\n    const fetchData = useCallback(async () => {\n        if (!isRunning || !builderStatus?.port) {\n            return;\n        }\n\n        setState((prev) => ({ ...prev, isLoading: true, error: null }));\n\n        try {\n            const baseUrl = `http://localhost:${builderStatus.port}`;\n\n            const [configResponse, dataResponse] = await Promise.all([\n                fetch(`${baseUrl}/api/config`),\n                fetch(`${baseUrl}/api/data`),\n            ]);\n\n            if (!configResponse.ok) {\n                throw new Error(`Failed to fetch config: ${configResponse.statusText}`);\n            }\n            if (!dataResponse.ok) {\n                throw new Error(`Failed to fetch data: ${dataResponse.statusText}`);\n            }\n\n            const config = await configResponse.json();\n            const data = await dataResponse.json();\n\n            setState({\n                config,\n                data,\n                error: null,\n                isLoading: false,\n            });\n        } catch (err) {\n            setState({\n                config: null,\n                data: null,","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/frontend/builder/tabs/builder-configdatatab.tsx#L80-L116","documentation":"The builder config/data tab loads both /api/config and /api/data from the builder backend in parallel. If the config fetch resolves with a non-2xx status, this error surfaces the HTTP statusText so the tab can show the load failure instead of parsing an error body as JSON.","triggerScenarios":"The GET {baseUrl}/api/config request returns 404/500/502 etc. — backend not running at baseUrl, route renamed/removed, or a proxy/gateway returning an error page.","commonSituations":"Builder server not started or crashed, wrong baseUrl/port in the tab configuration, API version mismatch between frontend and backend, auth middleware rejecting the request.","solutions":["Check the statusText/status: 404 → wrong baseUrl or missing route; 500 → backend exception; 401/403 → auth.","Confirm the builder backend is running and reachable at baseUrl (curl {baseUrl}/api/config).","Update frontend and backend together so the /api/config route matches.","Inspect backend logs for the failing request."],"exampleFix":"// before\nconst [configResponse, dataResponse] = await Promise.all([\n  fetch(`${baseUrl}/api/config`),\n  fetch(`${baseUrl}/api/data`),\n]);\nif (!configResponse.ok) throw new Error(`Failed to fetch config: ${configResponse.statusText}`);\n// after — fail fast with actionable status and check server first\nconst baseUrl = await ensureBuilderServerRunning(); // start server if not up\nconst res = await fetch(`${baseUrl}/api/config`);\nif (!res.ok) throw new Error(`Config fetch failed: HTTP ${res.status} ${res.statusText} at ${baseUrl}/api/config`);","handlingStrategy":"try-catch","validationCode":"async function assertEndpoint(baseUrl: string) {\n  try {\n    const res = await fetch(`${baseUrl}/api/config`);\n    return res.ok;\n  } catch {\n    return false; // server unreachable\n  }\n}\nif (!(await assertEndpoint(baseUrl))) throw new Error(`builder backend unreachable at ${baseUrl}`);","typeGuard":null,"tryCatchPattern":"try {\n  await loadConfigAndData(baseUrl);\n} catch (e) {\n  if (String(e.message).startsWith(\"Failed to fetch config\")) {\n    setState({ error: `builder backend issue: ${e.message} — is the server running at ${baseUrl}?` });\n    return;\n  }\n  throw e;\n}","preventionTips":["Verify the backend is running and the baseUrl/port is correct before loading the tab.","Keep frontend and backend API routes versioned/updated together.","Curl the endpoint when debugging to separate client vs server problems.","Show statusText plus URL in surfaced errors for faster triage."],"tags":["network","http","fetch","builder"],"backgroundTag":"http-request-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}