{"record":{"id":"619ed6ccdcb5f575","repo":"jackwener/OpenCLI","slug":"is-required-619ed6","errorCode":null,"errorMessage":"is required","messagePattern":"is required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/trae-solo/renderer-storage.js","lineNumber":92,"sourceCode":"\n// -------- storage-get --------\ncli({\n    site: 'trae-solo',\n    name: 'storage-get',\n    access: 'read',\n    description: 'Read a single localStorage / sessionStorage value on the Trae SOLO renderer.',\n    domain: 'localhost',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [\n        { name: 'key', positional: true, required: true, help: 'Storage key (use storage-keys to discover)' },\n        { name: 'storage', required: false, default: 'local', help: '\"local\" or \"session\"' },\n        { name: 'max-bytes', type: 'int', required: false, default: 4000, help: 'Truncate value to this many chars' },\n    ],\n    columns: ['Field', 'Value'],\n    func: async (page, kwargs) => {\n        const key = String(kwargs?.key || '').trim();\n        if (!key) throw new ArgumentError('key', 'is required');\n        const store = pickStore(kwargs);\n        const raw = await page.evaluate(`${store}.getItem(${JSON.stringify(key)})`);\n        if (raw === null) throw new CommandExecutionError(`Key not found in ${store}: ${key}`, '');\n        const max = Number.isInteger(kwargs['max-bytes']) && kwargs['max-bytes'] > 0 ? kwargs['max-bytes'] : 4000;\n        let parsed = raw, kind = 'string';\n        try { parsed = JSON.parse(raw); kind = Array.isArray(parsed) ? 'array' : typeof parsed; } catch {}\n        const text = kind === 'string' ? parsed : JSON.stringify(parsed, null, 2);\n        const truncated = text.length > max;\n        return [\n            { Field: 'Key', Value: key },\n            { Field: 'Store', Value: store },\n            { Field: 'Type', Value: kind },\n            { Field: 'Size', Value: `${text.length} chars${truncated ? ' (truncated)' : ''}` },\n            { Field: 'Value', Value: truncated ? text.slice(0, max) + '\\n...(truncated)' : text },\n        ];\n    },\n});\n","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trae-solo/renderer-storage.js#L74-L110","documentation":"An ArgumentError thrown by the `storage-get` command when the `key` kwarg is missing, an empty string, or only whitespace after trimming. Web Storage reads require a concrete key, so the command fails fast before touching the page.","triggerScenarios":"Calling storage-get without `key`, with key:'' , key:' ', or with a mistyped kwarg name (e.g. `name=` or `k=`) so kwargs.key is undefined.","commonSituations":"Scripting pipelines where a variable holding the key name is empty; copying commands from docs and forgetting the required kwarg; passing the value positionally when the command expects a named kwarg.","solutions":["Pass a non-empty `key` kwarg, e.g. key=\"theme\".","Fix the kwarg spelling so the value lands in kwargs.key.","Validate the upstream variable is non-empty before invoking.","Run storage-keys first to confirm the exact key name."],"exampleFix":"// before\nawait cli('trae-solo', 'storage-get', {});\n// after\nconst key = process.env.STORAGE_KEY;\nif (!key) throw new Error('STORAGE_KEY not set');\nawait cli('trae-solo', 'storage-get', { key });","handlingStrategy":"validation","validationCode":"const key = String(kwargs.key ?? '').trim();\nif (!key) throw new Error('storage-get requires a non-empty key kwarg');","typeGuard":"const hasKey = (kwargs) =>\n  typeof kwargs?.key === 'string' && kwargs.key.trim().length > 0;","tryCatchPattern":"try {\n  await cli('trae-solo', 'storage-get', { key });\n} catch (e) {\n  if (/is required/.test(e.message) && /key/.test(e.message + '')) {\n    console.error('Missing key. Usage: storage-get key=<name>');\n  } else throw e;\n}","preventionTips":["Validate variables holding key names are non-empty before invoking.","Always pass key as a named kwarg, not positionally.","Trim user-supplied keys and reject whitespace-only values early.","Consult storage-keys output to confirm key names before reads."],"tags":["argument-validation","missing-argument","storage","trae"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}