{"record":{"id":"29146c92cc4a229f","repo":"garrytan/gstack","slug":"file-too-large-for-base64-10mb-use-disk-down","errorCode":null,"errorMessage":"File too large for --base64 (>10MB). Use disk download + GET /file instead.","messagePattern":"File too large for --base64 \\(>10MB\\)\\. Use disk download \\+ GET /file instead\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"browse/src/write-commands.ts","lineNumber":1290,"sourceCode":"        // 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';\n        buffer = Buffer.from(await response.body());\n        if (buffer.length > 200 * 1024 * 1024) {\n          throw new Error('File too large (>200MB).');\n        }\n      }\n\n      // --base64 mode: return inline\n      if (isBase64) {\n        if (buffer.length > 10 * 1024 * 1024) {\n          throw new Error('File too large for --base64 (>10MB). Use disk download + GET /file instead.');\n        }\n        const mimeType = contentType.split(';')[0].trim();\n        return `data:${mimeType};base64,${buffer.toString('base64')}`;\n      }\n\n      // Write to disk\n      const ext = contentType.split(';')[0].includes('/')\n        ? mimeToExt(contentType.split(';')[0].trim())\n        : '.bin';\n      const destPath = outputPath || path.join(TEMP_DIR, `browse-download-${Date.now()}${ext}`);\n      validateOutputPath(destPath);\n      fs.writeFileSync(destPath, buffer);\n      const sizeKB = Math.round(buffer.length / 1024);\n      return `Downloaded: ${destPath} (${sizeKB}KB, ${contentType.split(';')[0].trim()})`;\n    }\n\n    case 'scrape': {\n      if (args.length === 0) throw new Error('Usage: scrape <images|videos|media> [--selector sel] [--dir path] [--limit N]');","sourceCodeStart":1272,"sourceCodeEnd":1308,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/write-commands.ts#L1272-L1308","documentation":"Error \"File too large for --base64 (>10MB). Use disk download + GET /file instead.\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/write-commands.ts:1290 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"}