{"record":{"id":"2389dff2ce9dbd4a","repo":"jackwener/OpenCLI","slug":"state-vscdb-not-found-trae-global-state-db","errorCode":null,"errorMessage":"state.vscdb not found: ${TRAE_GLOBAL_STATE_DB}","messagePattern":"state\\.vscdb not found: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/trae-solo/state-fs.js","lineNumber":130,"sourceCode":"    },\n});\n\n// -------- recent-workspaces --------\ncli({\n    site: 'trae-solo',\n    name: 'recent-workspaces',\n    access: 'read',\n    description: 'Show Trae SOLO\\'s recently-opened workspaces (the File → Open Recent menu, stored under key \"history.recentlyOpenedPathsList\" in state.vscdb).',\n    domain: 'localhost',\n    browser: false,\n    strategy: Strategy.LOCAL,\n    args: [\n        { name: 'limit', type: 'int', required: false, default: 20 },\n    ],\n    columns: ['Index', 'Key', 'Kind', 'Path'],\n    func: async (args) => {\n        if (!fs.existsSync(TRAE_GLOBAL_STATE_DB)) {\n            throw new CommandExecutionError(`state.vscdb not found: ${TRAE_GLOBAL_STATE_DB}`, '');\n        }\n        const val = getValue(TRAE_GLOBAL_STATE_DB, 'history.recentlyOpenedPathsList');\n        if (!val) {\n            throw new EmptyResultError('trae-solo recent-workspaces', 'No recent workspaces recorded.');\n        }\n        const entries = val.entries || [];\n        if (!entries.length) {\n            throw new EmptyResultError('trae-solo recent-workspaces', 'history.recentlyOpenedPathsList has no entries.');\n        }\n        const limit = Number.isInteger(args.limit) && args.limit > 0 ? args.limit : 20;\n        return entries.slice(0, limit).map((e, i) => {\n            let kind = 'other', target = JSON.stringify(e).slice(0, 200);\n            if (e.folderUri) {\n                kind = 'folder';\n                target = decodeURI(String(e.folderUri).replace(/^file:\\/\\//, ''));\n            } else if (e.workspace && e.workspace.configPath) {\n                kind = 'workspace';\n                target = decodeURI(String(e.workspace.configPath).replace(/^file:\\/\\//, ''));","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trae-solo/state-fs.js#L112-L148","documentation":"Thrown by the recent-workspaces command when the global state DB file TRAE_GLOBAL_STATE_DB does not exist on disk. The command requires reading 'history.recentlyOpenedPathsList' from that SQLite DB, so without the file it cannot proceed.","triggerScenarios":"Running recent-workspaces on a machine where Trae has never been launched, after Trae's data directory was deleted/moved, or when the CLI's configured Trae profile path does not match the installed version.","commonSituations":"Fresh OS/container without Trae installed; Trae installed for a different user; custom TRAE data dir env var pointing elsewhere; upgrading Trae changed the storage layout.","solutions":["Launch Trae at least once so it creates state.vscdb, then retry.","Verify the DB path (print TRAE_GLOBAL_STATE_DB / the path in the message) and check it exists with ls.","Point the CLI's Trae data-directory configuration at the profile that actually contains state.vscdb.","If Trae is installed per-user, run the CLI as that user."],"exampleFix":"// before\nopencli trae-solo recent-workspaces   # fails: no Trae profile on this machine\n// after\nopen trae   # launch once to create state.vscdb\nopencli trae-solo recent-workspaces","handlingStrategy":"fallback","validationCode":"const fs = require('fs');\nif (!fs.existsSync(TRAE_GLOBAL_STATE_DB)) {\n  console.error(`Trae DB missing at ${TRAE_GLOBAL_STATE_DB}; launch Trae once or fix data dir`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await recentWorkspaces(args);\n} catch (e) {\n  if (/state.vscdb not found/.test(e.message)) return workspacesList(args); // scan workspaceStorage instead\n  throw e;\n}","preventionTips":["Ensure Trae has been launched at least once on this machine/user","Verify the TRAE data directory configuration matches the installed profile","Run the CLI as the same user that runs Trae","Check the DB path with ls after any OS/Trae upgrade"],"tags":["filesystem","missing-file","environment"],"backgroundTag":"file-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}