{"record":{"id":"abc7f38d05fe59d2","repo":"cube-js/cube","slug":"unexpected-response-response-statustext","errorCode":null,"errorMessage":"unexpected response ${response.statusText}","messagePattern":"unexpected response (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cubejs-backend-shared/src/http-utils.ts","lineNumber":192,"sourceCode":"\ntype DownloadAndExtractFile = {\n  showProgress: boolean;\n  cwd: string;\n  skipExtract?: boolean;\n  dstFileName?: string;\n};\n\nexport async function downloadAndExtractFile(url: string, { cwd, skipExtract, dstFileName }: DownloadAndExtractFile) {\n  const request = new Request(url, {\n    headers: new Headers({\n      'Content-Type': 'application/octet-stream',\n    }),\n    agent: await getHttpAgentForProxySettings(),\n  });\n\n  const response = await fetch(request);\n  if (!response.ok) {\n    throw new Error(`unexpected response ${response.statusText}`);\n  }\n\n  const bar = new SingleBar({\n    format: 'Downloading [{bar}] {percentage}% | Speed: {speed}',\n  });\n  bar.start(100, 0);\n\n  try {\n    mkdirpSync(cwd);\n  } catch (e: any) {\n    internalExceptions(e);\n  }\n\n  const savedFilePath = await streamWithProgress(response, ({ progress, speed, eta }) => {\n    bar.update(progress, {\n      speed,\n      eta,\n    });","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/packages/cubejs-backend-shared/src/http-utils.ts#L174-L210","documentation":"downloadAndExtractFile() fetches a remote file and throws this error whenever the HTTP response is not ok (response.ok is false, i.e. status outside 2xx). The response's statusText is embedded in the message so the developer can see the HTTP-level reason for the failed download.","triggerScenarios":"Any call to downloadAndExtractFile (used by getExternalMaven, downloadJDBCDriver, downloadBinaryFromRelease) where the remote server returns 404, 403, 500, etc. — e.g. a bad release/version URL, missing artifact, private repo requiring auth, or rate-limited/forbidden CDN response.","commonSituations":"Specifying a JDBC driver or Cube Store version that does not exist in the release repo; corporate proxy blocking the download (403/407); GitHub/release URL changed or artifact renamed; offline/blocked network producing gateway errors.","solutions":["Check the message's statusText/status: fix the URL or version so the resource actually exists (404) or is accessible (403)","Verify network/proxy settings — set HTTPS_PROXY/http_proxy env vars so fetch can reach the host through the corporate proxy","If downloading a JDBC driver manually, place the jar in the expected .cubejs-system-cubes directory to skip the download","Retry later if the status indicates a transient server-side failure (5xx)"],"exampleFix":"// before (404 - wrong version)\nawait downloadJDBCDriver('nonexistent-dialect');\n// after\nawait downloadJDBCDriver('postgres'); // ensure the driver/version exists in the release repo","handlingStrategy":"try-catch","validationCode":"const res = await fetch(url, { method: 'HEAD' });\nif (!res.ok) throw new Error(`Download URL unavailable: ${res.status} ${res.statusText} for ${url}`);","typeGuard":"null","tryCatchPattern":"try {\n  await downloadAndExtractFile(url, { cwd, showProgress: true });\n} catch (e) {\n  if (e.message.startsWith('unexpected response')) {\n    const status = e.message.replace('unexpected response ', '');\n    console.error(`Download failed (HTTP ${status}); verify the URL/version and proxy settings`);\n  } else throw e;\n}","preventionTips":["Pre-flight the URL with a HEAD request before downloading","Pin exact, existing release versions for JDBC drivers / Cube Store binaries","Configure HTTPS_PROXY/NO_PROXY correctly in corporate networks","Handle transient 5xx with a retry/backoff wrapper around the download call"],"tags":["http","network","download","fetch"],"backgroundTag":"http-request-failed","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}