jackwener/OpenCLI · error · ArgumentError

storage

Error message

storage

What it means

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.

Source

Thrown at clis/trae-solo/renderer-storage.js:24

//
//   storage-keys [--storage local|session] [--filter] [--limit]
//   storage-get <key> [--storage] [--max-bytes]
//   cookies          — list JS-visible cookies on the renderer
//   idb-list         — list IndexedDB databases the renderer can see
//                       (Trae SOLO ships an @byted/ve-rtc DB for the
//                        Volcengine RTC voice/video infra)

import { cli, Strategy } from '@jackwener/opencli/registry';
import {
    ArgumentError,
    CommandExecutionError,
    EmptyResultError,
} from '@jackwener/opencli/errors';

function pickStore(args) {
    const s = String(args?.storage || 'local').trim().toLowerCase();
    if (s !== 'local' && s !== 'session') {
        throw new ArgumentError('storage', 'must be "local" or "session"');
    }
    return s === 'session' ? 'sessionStorage' : 'localStorage';
}

// -------- storage-keys --------
cli({
    site: 'trae-solo',
    name: 'storage-keys',
    access: 'read',
    description: 'List localStorage / sessionStorage keys on the Trae SOLO renderer (CDP). For the on-disk VSCode state.vscdb, see state-keys.',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [
        { name: 'storage', required: false, default: 'local', help: '"local" or "session"' },
        { name: 'filter', required: false, help: 'Case-insensitive substring filter' },
        { name: 'limit', type: 'int', required: false, default: 100, help: 'Max rows to return' },
    ],

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass `storage=local` or `storage=session` (case/whitespace insensitive).
  2. Remove the `storage` kwarg entirely to use the default 'local'.
  3. Check for typos like 'sessionstorage', 'session_storage', or 'ls'.
  4. If the value comes from a variable/config, validate it before invoking the command.

Example fix

// before
await cli('trae-solo', 'storage-keys', { storage: 'sessionStorage' });
// after
await cli('trae-solo', 'storage-keys', { storage: 'session' });
Defensive patterns

Strategy: validation

Validate before calling

const VALID = new Set(['local', 'session']);
const store = String(kwargs.storage ?? 'local').trim().toLowerCase();
if (!VALID.has(store)) throw new Error(`storage must be "local" or "session", got: ${kwargs.storage}`);

Type guard

const isStorageKind = (v) =>
  typeof v === 'string' && ['local', 'session'].includes(v.trim().toLowerCase());

Try / catch

try {
  await cli('trae-solo', 'storage-keys', { storage });
} catch (e) {
  if (/must be "local" or "session"/.test(e.message) || e.message === 'storage') {
    console.warn(`Invalid storage='${storage}', defaulting to local`);
    await cli('trae-solo', 'storage-keys', {});
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/8b90dfb1fb96cf2b. Report an issue: GitHub.