{"record":{"id":"6d5705b4735d872e","repo":"jackwener/OpenCLI","slug":"workspace-state-vscdb-not-found-db","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/antigravity/storage.js","lineNumber":70,"sourceCode":"        );\n    }\n}\nfunction listKeys(db) {\n    const out = sqliteQuery(db, 'SELECT key FROM ItemTable ORDER BY key;');\n    return out.split('\\n').map((s) => s.trim()).filter(Boolean);\n}\nfunction getValue(db, key) {\n    const esc = key.replace(/'/g, \"''\");\n    const raw = sqliteQuery(db, `SELECT value FROM ItemTable WHERE key = '${esc}';`).trim();\n    if (!raw) return null;\n    try { return JSON.parse(raw); } catch { return raw; }\n}\nfunction resolveStateDb(args) {\n    const ws = args?.workspace ? String(args.workspace).trim() : '';\n    if (!ws) return AG_GLOBAL_STATE_DB;\n    const db = path.join(AG_WORKSPACE_STORAGE, ws, 'state.vscdb');\n    if (!fs.existsSync(db)) {\n        throw new CommandExecutionError(`Workspace state.vscdb not found: ${db}`, 'List workspace ids with `opencli antigravity workspaces-list`.');\n    }\n    return db;\n}\n\n// ====== Renderer-side: storage-keys ======\ncli({\n    site: 'antigravity',\n    name: 'storage-keys',\n    access: 'read',\n    description: 'List localStorage / sessionStorage keys on the Antigravity renderer (CDP).',\n    domain: '127.0.0.1',\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":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/antigravity/storage.js#L52-L88","documentation":"resolveStateDb() resolves the path to a workspace-scoped state.vscdb under ~/Library/Application Support/Antigravity/User/workspaceStorage/<ws>/state.vscdb when a --workspace argument is passed. It throws CommandExecutionError if the file does not exist on disk. This guards the state-keys/state-get commands against querying a per-workspace database that Antigravity never created.","triggerScenarios":"Calling `opencli antigravity state-keys --workspace <id>` or `state-get <key> --workspace <id>` where <id> does not match an existing directory in workspaceStorage containing a state.vscdb (typo'd id, pruned workspace, or id invented instead of taken from workspaces-list).","commonSituations":"Developers copy a workspace id from another machine, use a folder path instead of the hex workspace id, reference a workspace whose storage was cleaned up by Antigravity, or run on a machine where the workspace was never opened in the IDE.","solutions":["Run `opencli antigravity workspaces-list` and copy the exact 'Workspace Id' value.","Re-run the command with that exact id: --workspace <id>.","Omit --workspace entirely to query the global state.vscdb instead.","Verify the file exists: ls ~/Library/Application\\ Support/Antigravity/User/workspaceStorage/<id>/state.vscdb; if missing, open the folder in Antigravity once to create it."],"exampleFix":"// before\nopencli antigravity state-keys --workspace /Users/me/proj\n// after\nopencli antigravity workspaces-list   # get e.g. '3f9c2a1e...'\nopencli antigravity state-keys --workspace 3f9c2a1e...","handlingStrategy":"validation","validationCode":"const ws = '3f9c2a1e...';\nconst db = `${process.env.HOME}/Library/Application Support/Antigravity/User/workspaceStorage/${ws}/state.vscdb`;\nif (!require('node:fs').existsSync(db)) throw new Error(`No state.vscdb for workspace ${ws}; run 'opencli antigravity workspaces-list' to get valid ids`);","typeGuard":"function hasWorkspaceDb(ws) {\n  if (typeof ws !== 'string' || !/^[a-f0-9]{16,}$/i.test(ws.trim())) return false;\n  return require('node:fs').existsSync(\n    `${process.env.HOME}/Library/Application Support/Antigravity/User/workspaceStorage/${ws.trim()}/state.vscdb`\n  );\n}","tryCatchPattern":"try {\n  execSync(`opencli antigravity state-keys --workspace ${ws}`);\n} catch (e) {\n  if (/Workspace state\\.vscdb not found/.test(e.message)) {\n    // fall back to global DB\n    execSync('opencli antigravity state-keys');\n  } else throw e;\n}","preventionTips":["Always source workspace ids from `workspaces-list` output, never from memory or paths.","Validate the id against /^([a-f0-9]{16,})$/ before passing --workspace.","fs.existsSync() the expected state.vscdb path before invoking the command.","Omit --workspace when you only need global state."],"tags":["filesystem","workspace","path-not-found","antigravity"],"backgroundTag":"state-db-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}