{"record":{"id":"62a67b3712e93d97","repo":"garrytan/gstack","slug":"usage-browse-eval-js-file-out-file-raw","errorCode":null,"errorMessage":"Usage: browse eval <js-file> [--out <file>] [--raw]","messagePattern":"Usage: browse eval <js-file> \\[--out <file>\\] \\[--raw\\]","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"browse/src/read-commands.ts","lineNumber":310,"sourceCode":"    case 'js': {\n      const { outPath, raw, rest } = parseOutArgs(args);\n      const expr = rest[0];\n      if (!expr) throw new Error('Usage: browse js <expression> [--out <file>] [--raw]');\n      if (bm) assertJsOriginAllowed(bm, page.url());\n      const wrapped = wrapForEvaluate(expr);\n      const result = await target.evaluate(wrapped);\n      const str = resultToString(result);\n      if (outPath) {\n        const n = writeEvalResult(outPath, str, { raw });\n        return `JS result written: ${outPath} (${n} bytes)`;\n      }\n      return str;\n    }\n\n    case 'eval': {\n      const { outPath, raw, rest } = parseOutArgs(args);\n      const filePath = rest[0];\n      if (!filePath) throw new Error('Usage: browse eval <js-file> [--out <file>] [--raw]');\n      if (bm) assertJsOriginAllowed(bm, page.url());\n      validateReadPath(filePath);\n      if (!fs.existsSync(filePath)) throw new Error(`File not found: ${filePath}`);\n      const code = fs.readFileSync(filePath, 'utf-8');\n      const wrapped = wrapForEvaluate(code);\n      const result = await target.evaluate(wrapped);\n      const str = resultToString(result);\n      if (outPath) {\n        const n = writeEvalResult(outPath, str, { raw });\n        return `Eval result written: ${outPath} (${n} bytes)`;\n      }\n      return str;\n    }\n\n    case 'css': {\n      const [selector, property] = args;\n      if (!selector || !property) throw new Error('Usage: browse css <selector> <property>');\n      const resolved = await session.resolveRef(selector);","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/garrytan/gstack/blob/94993f74012782fd94416dd44b8314f6363a13a4/browse/src/read-commands.ts#L292-L328","documentation":"Error \"Usage: browse eval <js-file> [--out <file>] [--raw]\" thrown in garrytan/gstack.","triggerScenarios":"Thrown at browse/src/read-commands.ts:310 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"}