{"record":{"id":"ebeab872f19b1080","repo":"wavetermdev/waveterm","slug":"failed-to-fetch-data-dataresponse-statustext","errorCode":null,"errorMessage":"Failed to fetch data: ${dataResponse.statusText}","messagePattern":"Failed to fetch data: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/builder/tabs/builder-configdatatab.tsx","lineNumber":101,"sourceCode":"        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,\n                error: err instanceof Error ? err.message : String(err),\n                isLoading: false,\n            });","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/frontend/builder/tabs/builder-configdatatab.tsx#L83-L119","documentation":"Same parallel fetch flow as the config error, but for /api/data: if the data endpoint responds with a non-2xx status, this error is thrown. Config may have succeeded while data failed, pointing at the data endpoint specifically.","triggerScenarios":"GET {baseUrl}/api/data returns non-2xx — data store unavailable/corrupt on the backend, the data route erroring, or a proxy returning 502/504 while config (cached/static) still succeeds.","commonSituations":"Backend's data file/database missing or locked, backend exception while serializing data, partial outage of the builder service behind a reverse proxy.","solutions":["Check the specific status: 500 → backend data error (check server logs); 404 → route/baseUrl mismatch; 502/504 → upstream/proxy issue.","Verify the backend's data source (file/db) exists and is readable.","Curl {baseUrl}/api/data directly to reproduce outside the UI.","Handle config-ok/data-failed gracefully: keep cached data and surface a retry instead of blanking the tab."],"exampleFix":"// before\nconst data = await dataResponse.json(); // assumes ok\n// after\nif (!dataResponse.ok) {\n  console.error(`data endpoint failed: HTTP ${dataResponse.status}`);\n  throw new Error(`Failed to fetch data: HTTP ${dataResponse.status} ${dataResponse.statusText}`);\n}\nconst data = await dataResponse.json();","handlingStrategy":"try-catch","validationCode":"const res = await fetch(`${baseUrl}/api/data`);\nif (!res.ok) {\n  console.error(`/api/data unhealthy: HTTP ${res.status}`);\n  throw new Error(`data endpoint unavailable at ${baseUrl} (HTTP ${res.status})`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await loadConfigAndData(baseUrl);\n} catch (e) {\n  if (String(e.message).startsWith(\"Failed to fetch data\")) {\n    // keep last-known-good data and offer retry\n    setState({ error: e.message, staleData: true });\n    return;\n  }\n  throw e;\n}","preventionTips":["Check backend data-store health (file/db exists and is readable) on server startup.","Monitor the /api/data endpoint separately from /api/config since they can fail independently.","Preserve cached data in the UI so a data-fetch failure doesn't blank the tab.","Log response.status (not just statusText) — statusText can be empty on HTTP/2."],"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"}