{"record":{"id":"2682d37ea53bb525","repo":"cockroachdb/cockroach","slug":"error-response-from-server-resp-status","errorCode":null,"errorMessage":"Error response from server: ${resp.status}","messagePattern":"Error response from server: (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"pkg/ui/workspaces/db-console/src/util/dataFromServer.ts","lineNumber":43,"sourceCode":"// Tell TypeScript about `window.dataFromServer`, which is set in a script\n// tag in index.html, the contents of which are generated in a Go template\n// server-side.\ndeclare global {\n  interface Window {\n    dataFromServer: DataFromServer;\n  }\n}\n\nexport function fetchDataFromServer(): Promise<DataFromServer> {\n  return fetch(\"uiconfig\", {\n    method: \"GET\",\n    headers: {\n      Accept: \"application/json\",\n      \"Content-Type\": \"application/json\",\n    },\n  }).then(resp => {\n    if (resp.status >= 400) {\n      throw new Error(`Error response from server: ${resp.status}`);\n    }\n    return resp.json();\n  });\n}\n\nexport function getDataFromServer(): DataFromServer {\n  return (\n    window.dataFromServer ||\n    ({\n      FeatureFlags: {},\n    } as DataFromServer)\n  );\n}\n\nexport function setDataFromServer(d: DataFromServer) {\n  window.dataFromServer = d;\n}\n","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/cockroachdb/cockroach/blob/8812064a015d2faf99d3fc7e15880f94042954b0/pkg/ui/workspaces/db-console/src/util/dataFromServer.ts#L25-L61","documentation":"At DB Console bootstrap, fetchDataFromServer GETs the relative 'uiconfig' endpoint to obtain server-provided configuration; any HTTP status >= 400 throws 'Error response from server: <status>'. This is the static-bootstrap config path (served by the node's HTTP endpoint), distinct from the admin API, and the thrown number is the raw HTTP status.","triggerScenarios":"The request for /uiconfig returning 4xx/5xx: a reverse proxy rewriting or stripping the path, an auth layer in front of the console rejecting the request, a mis-routed load balancer sending the request to a non-console service, or a node not serving the console.","commonSituations":"Accessing the console through a proxy whose location block doesn't pass /uiconfig; OAuth/SSO front-ends intercepting static paths; stale HTML bundle after node upgrade requesting an endpoint removed/renamed; accessing a node with a different --http-addr setup.","solutions":["Open /uiconfig directly in the browser to see the real status and body","Fix the proxy so /uiconfig (and other console paths) reach the node's HTTP endpoint unmodified","Hard-refresh / clear cache after upgrading nodes to drop a stale bundle","Verify the node's HTTP settings and that you are hitting a node that serves the DB Console"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Probe the endpoint before bootstrapping the app\nconst probe = await fetch('uiconfig', { method: 'HEAD' });\nif (!probe.ok) {\n  showProxyErrorBanner(probe.status);\n}","typeGuard":null,"tryCatchPattern":"import { fetchDataFromServer, getDataFromServer } from 'src/util/dataFromServer';\ntry {\n  dataFromServer = await fetchDataFromServer();\n} catch (e) {\n  // Fall back to the server-injected window global when present\n  dataFromServer = getDataFromServer();\n  if (!dataFromServer?.LoginURL) {\n    throw e; // no fallback available\n  }\n}","preventionTips":["Proxy-test /uiconfig (and static console paths) in staging before rollout","Keep the node bundle and cluster version in sync to avoid stale bootstrap requests","Distinguish this bootstrap failure from admin API failures when debugging proxies"],"tags":["db-console","http","proxy","bootstrap","typescript"],"backgroundTag":null,"analyzedSha":"8812064a015d2faf99d3fc7e15880f94042954b0","analyzedAt":"2026-08-15T16:34:17.351Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}