{"record":{"id":"f444df0d95c901a4","repo":"garrytan/gstack","slug":"unknown-write-command-command","errorCode":null,"errorMessage":"Unknown write command: ${command}","messagePattern":"Unknown write command: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"browse/src/write-commands.ts","lineNumber":1425,"sourceCode":"    case 'archive': {\n      const page = bm.getPage();\n      const outputPath = args[0] || path.join(TEMP_DIR, `browse-archive-${Date.now()}.mhtml`);\n      validateOutputPath(outputPath);\n\n      try {\n        const data = await withCdpSession(page, async (cdp) => {\n          const result = await cdp.send('Page.captureSnapshot', { format: 'mhtml' });\n          return (result as { data: string }).data;\n        });\n        fs.writeFileSync(outputPath, data);\n        return `Archive saved: ${outputPath} (${Math.round(data.length / 1024)}KB, MHTML)`;\n      } catch (err: any) {\n        throw new Error(`MHTML archive requires Chromium CDP. Use 'text' or 'html' for raw page content. (${err.message})`);\n      }\n    }\n\n    default:\n      throw new Error(`Unknown write command: ${command}`);\n  }\n}\n\n/** Map MIME type to file extension. */\nfunction mimeToExt(mime: string): string {\n  const map: Record<string, string> = {\n    'image/png': '.png', 'image/jpeg': '.jpg', 'image/gif': '.gif',\n    'image/webp': '.webp', 'image/svg+xml': '.svg', 'image/avif': '.avif',\n    'video/mp4': '.mp4', 'video/webm': '.webm', 'video/quicktime': '.mov',\n    'audio/mpeg': '.mp3', 'audio/wav': '.wav', 'audio/ogg': '.ogg',\n    'application/pdf': '.pdf', 'application/json': '.json',\n    'text/html': '.html', 'text/plain': '.txt',\n  };\n  return map[mime] || '.bin';\n}\n","sourceCodeStart":1407,"sourceCodeEnd":1441,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/write-commands.ts#L1407-L1441","documentation":"Error \"Unknown write command: ${command}\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/write-commands.ts:1425 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"}