{"record":{"id":"c5107fcb2d08b485","repo":"garrytan/gstack","slug":"file-too-large-200mb","errorCode":null,"errorMessage":"File too large (>200MB).","messagePattern":"File too large \\(>200MB\\)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"browse/src/write-commands.ts","lineNumber":1262,"sourceCode":"            };\n            contentType = mimeMap[extLower] || 'application/octet-stream';\n          }\n        }\n        // Clean up temp file if we're going to write elsewhere\n        if (outputPath || isBase64) {\n          try { fs.unlinkSync(tempPath); } catch { /* ignore */ }\n        } else {\n          // No explicit output path — rename temp file with inferred extension.\n          const ext = contentType.split(';')[0].includes('/')\n            ? mimeToExt(contentType.split(';')[0].trim())\n            : '.bin';\n          const finalPath = path.join(TEMP_DIR, `browse-download-${Date.now()}${ext}`);\n          fs.renameSync(tempPath, finalPath);\n          const sizeKB = Math.round(buffer.length / 1024);\n          return `Downloaded: ${finalPath} (${sizeKB}KB, ${contentType.split(';')[0].trim()})${suggested ? ` [${suggested}]` : ''}`;\n        }\n        if (buffer.length > 200 * 1024 * 1024) {\n          throw new Error('File too large (>200MB).');\n        }\n      } else {\n        // Strategy 1: Direct URL via page.request.fetch().\n        // Gate the URL through the same validator `goto` uses. Without\n        // this check, download + scrape bypass the navigation\n        // blocklist and a caller with write scope can read\n        // http://169.254.169.254/latest/meta-data/ (AWS IMDSv1), the\n        // GCP/Azure metadata equivalents, or any internal IPv4/IPv6\n        // the server happens to route to. The response body is then\n        // returned to the caller (base64) or written to disk where\n        // GET /file serves it back.\n        await validateNavigationUrl(url);\n        const response = await page.request.fetch(url, { timeout: 30000 });\n        const status = response.status();\n        if (status >= 400) {\n          throw new Error(`Download failed: HTTP ${status} ${response.statusText()}`);\n        }\n        contentType = response.headers()['content-type'] || 'application/octet-stream';","sourceCodeStart":1244,"sourceCodeEnd":1280,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/write-commands.ts#L1244-L1280","documentation":"Error \"File too large (>200MB).\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/write-commands.ts:1262 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"}