{"record":{"id":"2ebbe740d5d6fd4b","repo":"jackwener/OpenCLI","slug":"workspace-state-vscdb-not-found-db-2ebbe7","errorCode":null,"errorMessage":"Workspace state.vscdb not found: ${db}","messagePattern":"Workspace state\\.vscdb not found: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/trae-solo/state-fs.js","lineNumber":39,"sourceCode":"    ArgumentError,\n    CommandExecutionError,\n    EmptyResultError,\n} from '@jackwener/opencli/errors';\nimport {\n    TRAE_GLOBAL_STATE_DB,\n    TRAE_WORKSPACE_STORAGE,\n    listKeys,\n    getValue,\n} from './_state.js';\n\n// Resolve the actual state.vscdb to read. With no --workspace, uses the\n// global state DB. With --workspace <id>, uses that workspaceStorage DB.\nfunction resolveStateDb(args) {\n    const ws = args.workspace ? String(args.workspace).trim() : '';\n    if (!ws) return TRAE_GLOBAL_STATE_DB;\n    const db = path.join(TRAE_WORKSPACE_STORAGE, ws, 'state.vscdb');\n    if (!fs.existsSync(db)) {\n        throw new CommandExecutionError(\n            `Workspace state.vscdb not found: ${db}`,\n            'List valid workspace ids with `opencli trae-solo workspaces-list`.',\n        );\n    }\n    return db;\n}\n\n// -------- state-keys --------\ncli({\n    site: 'trae-solo',\n    name: 'state-keys',\n    access: 'read',\n    description: 'List all keys present in Trae SOLO\\'s globalStorage state.vscdb (VSCode-style UI/agent state). Pass --workspace <ws-id> to query a per-workspace DB instead. Use state-get to read a specific value. (See renderer storage-keys for browser-side LS/SS.)',\n    domain: 'localhost',\n    browser: false,\n    strategy: Strategy.LOCAL,\n    args: [\n        { name: 'filter', required: false, help: 'Case-insensitive substring filter over keys' },","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trae-solo/state-fs.js#L21-L57","documentation":"resolveStateDb builds a path <TRAE_WORKSPACE_STORAGE>/<workspace-id>/state.vscdb and throws when that file does not exist. It only validates existence when a --workspace argument is supplied; the global DB is returned unchecked. The error means the supplied workspace id does not correspond to an actual workspaceStorage folder.","triggerScenarios":"Calling any trae-solo state command (state-keys, state-get, etc.) with --workspace set to an id whose folder has no state.vscdb, a mistyped/truncated id, or a workspace that was deleted from workspaceStorage.","commonSituations":"Typo or partial copy-paste of the workspace UUID; stale id from an old workspaces-list after Trae cleaned storage; pointing the CLI at a machine/user profile where the workspace never existed; Trae version change moving workspaceStorage.","solutions":["Run `opencli trae-solo workspaces-list` and copy an exact, currently valid workspace id.","Confirm the file exists at <TRAE_WORKSPACE_STORAGE>/<id>/state.vscdb (ls the directory) before passing --workspace.","Omit --workspace to query the global TRAE_GLOBAL_STATE_DB instead.","If the workspace was removed, re-open it once in Trae so its state.vscdb is recreated."],"exampleFix":"// before\nopencli trae-solo state-get --workspace abc123\n// after\nopencli trae-solo workspaces-list   # pick a valid id\nopencli trae-solo state-get --workspace 3f9c...  # exact folder name","handlingStrategy":"validation","validationCode":"const fs = require('fs'), path = require('path');\nconst db = path.join(TRAE_WORKSPACE_STORAGE, ws, 'state.vscdb');\nif (!ws.trim()) throw new Error('workspace id required');\nif (!fs.existsSync(db)) throw new Error(`workspace db missing: ${db} — run workspaces-list`);","typeGuard":"function isValidWorkspaceId(ws) { return typeof ws === 'string' && /^[A-Za-z0-9-]{8,}$/.test(ws.trim()); }","tryCatchPattern":"try {\n  const db = resolveStateDb(args);\n  // ...\n} catch (e) {\n  if (/state.vscdb not found/.test(e.message)) {\n    console.error('Run: opencli trae-solo workspaces-list');\n  }\n  throw e;\n}","preventionTips":["Copy workspace ids verbatim from workspaces-list, never type them by hand","Check the state.vscdb path exists before calling any state command with --workspace","Refresh the id list after Trae updates or storage cleanups","Omit --workspace when global state is what you need"],"tags":["filesystem","bad-argument","cli"],"backgroundTag":"file-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}