{"record":{"id":"8b90dfb1fb96cf2b","repo":"jackwener/OpenCLI","slug":"storage","errorCode":null,"errorMessage":"storage","messagePattern":"storage","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/trae-solo/renderer-storage.js","lineNumber":24,"sourceCode":"//\n//   storage-keys [--storage local|session] [--filter] [--limit]\n//   storage-get <key> [--storage] [--max-bytes]\n//   cookies          — list JS-visible cookies on the renderer\n//   idb-list         — list IndexedDB databases the renderer can see\n//                       (Trae SOLO ships an @byted/ve-rtc DB for the\n//                        Volcengine RTC voice/video infra)\n\nimport { cli, Strategy } from '@jackwener/opencli/registry';\nimport {\n    ArgumentError,\n    CommandExecutionError,\n    EmptyResultError,\n} from '@jackwener/opencli/errors';\n\nfunction pickStore(args) {\n    const s = String(args?.storage || 'local').trim().toLowerCase();\n    if (s !== 'local' && s !== 'session') {\n        throw new ArgumentError('storage', 'must be \"local\" or \"session\"');\n    }\n    return s === 'session' ? 'sessionStorage' : 'localStorage';\n}\n\n// -------- storage-keys --------\ncli({\n    site: 'trae-solo',\n    name: 'storage-keys',\n    access: 'read',\n    description: 'List localStorage / sessionStorage keys on the Trae SOLO renderer (CDP). For the on-disk VSCode state.vscdb, see state-keys.',\n    domain: 'localhost',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [\n        { name: 'storage', required: false, default: 'local', help: '\"local\" or \"session\"' },\n        { name: 'filter', required: false, help: 'Case-insensitive substring filter' },\n        { name: 'limit', type: 'int', required: false, default: 100, help: 'Max rows to return' },\n    ],","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trae-solo/renderer-storage.js#L6-L42","documentation":"An ArgumentError raised by `pickStore` in trae-solo's renderer-storage command when the `storage` kwarg is neither \"local\" nor \"session\" (after trimming and lowercasing). pickStore normalizes the argument and maps it to localStorage/sessionStorage; anything else is invalid because only those two Web Storage areas exist in the renderer.","triggerScenarios":"Passing `storage=Local`, `storage=cookie`, `storage=indexeddb`, an empty-ish value that isn't 'local'/'session', or any other kwarg typo to the storage-keys/storage-get commands.","commonSituations":"Users familiar with other tooling pass 'session' vs 'cookies' confusion; capitalization or trailing whitespace is handled, but values like 'sessionstorage' or 'ls' are not; scripting pipelines pass a variable that is empty or holds another backend name.","solutions":["Pass `storage=local` or `storage=session` (case/whitespace insensitive).","Remove the `storage` kwarg entirely to use the default 'local'.","Check for typos like 'sessionstorage', 'session_storage', or 'ls'.","If the value comes from a variable/config, validate it before invoking the command."],"exampleFix":"// before\nawait cli('trae-solo', 'storage-keys', { storage: 'sessionStorage' });\n// after\nawait cli('trae-solo', 'storage-keys', { storage: 'session' });","handlingStrategy":"validation","validationCode":"const VALID = new Set(['local', 'session']);\nconst store = String(kwargs.storage ?? 'local').trim().toLowerCase();\nif (!VALID.has(store)) throw new Error(`storage must be \"local\" or \"session\", got: ${kwargs.storage}`);","typeGuard":"const isStorageKind = (v) =>\n  typeof v === 'string' && ['local', 'session'].includes(v.trim().toLowerCase());","tryCatchPattern":"try {\n  await cli('trae-solo', 'storage-keys', { storage });\n} catch (e) {\n  if (/must be \"local\" or \"session\"/.test(e.message) || e.message === 'storage') {\n    console.warn(`Invalid storage='${storage}', defaulting to local`);\n    await cli('trae-solo', 'storage-keys', {});\n  } else throw e;\n}","preventionTips":["Use a whitelisted constant/enum for the storage argument in scripts.","Normalize with .trim().toLowerCase() before passing user input.","Default to omitting the kwarg when 'local' is intended.","Add a CLI/config schema check that rejects values other than local|session early."],"tags":["argument-validation","storage","trae"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}