{"record":{"id":"a441527611828b5c","repo":"garrytan/gstack","slug":"http-response-status","errorCode":null,"errorMessage":"HTTP ${response.status()}","messagePattern":"HTTP \\$\\{response\\.status\\(\\)\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"browse/src/write-commands.ts","lineNumber":1377,"sourceCode":"      const manifest: any = {\n        url: page.url(),\n        scraped_at: new Date().toISOString(),\n        files: [] as any[],\n        total_size: 0,\n        succeeded: 0,\n        failed: 0,\n      };\n\n      const lines: string[] = [];\n      for (let i = 0; i < toDownload.length; i++) {\n        const { url, type } = toDownload[i];\n        try {\n          // Same gate as the download command — page.request.fetch\n          // must not reach cloud metadata, ULA ranges, or the rest of\n          // the blocklist. See url-validation.ts for the full list.\n          await validateNavigationUrl(url);\n          const response = await page.request.fetch(url, { timeout: 30000 });\n          if (response.status() >= 400) throw new Error(`HTTP ${response.status()}`);\n          const ct = response.headers()['content-type'] || 'application/octet-stream';\n          const ext = mimeToExt(ct.split(';')[0].trim());\n          const filename = `${type}-${String(i + 1).padStart(3, '0')}${ext}`;\n          const filePath = path.join(dir, filename);\n          const body = Buffer.from(await response.body());\n          try {\n            fs.writeFileSync(filePath, body);\n          } catch (writeErr: any) {\n            throw new Error(`Disk write failed: ${writeErr.message}`);\n          }\n          manifest.files.push({ path: filename, src: url, size: body.length, type: ct.split(';')[0].trim() });\n          manifest.total_size += body.length;\n          manifest.succeeded++;\n          lines.push(`  [${i + 1}/${toDownload.length}] ${filename} (${Math.round(body.length / 1024)}KB)`);\n        } catch (err: any) {\n          manifest.files.push({ path: null, src: url, size: 0, type: '', error: err.message });\n          manifest.failed++;\n          lines.push(`  [${i + 1}/${toDownload.length}] FAILED: ${err.message}`);","sourceCodeStart":1359,"sourceCodeEnd":1395,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/write-commands.ts#L1359-L1395","documentation":"Error \"HTTP ${response.status()}\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/write-commands.ts:1377 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"}