{"record":{"id":"ac96384b2a5545fc","repo":"garrytan/gstack","slug":"failed-to-fetch-url-res-status-res-status","errorCode":null,"errorMessage":"Failed to fetch ${url}: ${res.status} ${res.statusText}","messagePattern":"Failed to fetch (.+?): (.+?) (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"browse/src/security-classifier.ts","lineNumber":141,"sourceCode":"    'off';\n  const transcript = haikuAvailableCache === null ? 'off' :\n    haikuAvailableCache ? 'ok' : 'degraded';\n  const status: ClassifierStatus = { testsavant, transcript };\n  if (isDebertaEnabled()) {\n    status.deberta =\n      debertaState === 'loaded' ? 'ok' :\n      debertaState === 'failed' ? 'degraded' :\n      'off';\n  }\n  return status;\n}\n\n// ─── Model download + staging ────────────────────────────────\n\nexport async function downloadFile(url: string, dest: string): Promise<void> {\n  const res = await fetch(url);\n  if (!res.ok || !res.body) {\n    throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`);\n  }\n  const tmp = `${dest}.tmp.${process.pid}`;\n  const writer = fs.createWriteStream(tmp);\n  // @ts-ignore — Node stream compat\n  const reader = res.body.getReader();\n  try {\n    let done = false;\n    while (!done) {\n      const chunk = await reader.read();\n      if (chunk.done) { done = true; break; }\n      writer.write(chunk.value);\n    }\n    await new Promise<void>((resolve, reject) => {\n      writer.end((err?: Error | null) => (err ? reject(err) : resolve()));\n    });\n    fs.renameSync(tmp, dest);\n  } catch (err) {\n    // Drop the half-written tmp so we don't ship a truncated model file to","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/security-classifier.ts#L123-L159","documentation":"Error \"Failed to fetch ${url}: ${res.status} ${res.statusText}\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/security-classifier.ts:141 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"94993f74012782fd94416dd44b8314f6363a13a4","analyzedAt":"2026-08-12T04:06:23.140Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}