jackwener/OpenCLI · error · CommandExecutionError

Workspace state.vscdb not found: ${db}

Error message

Workspace state.vscdb not found: ${db}

What it means

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.

Source

Thrown at clis/antigravity/storage.js:70

        );
    }
}
function listKeys(db) {
    const out = sqliteQuery(db, 'SELECT key FROM ItemTable ORDER BY key;');
    return out.split('\n').map((s) => s.trim()).filter(Boolean);
}
function getValue(db, key) {
    const esc = key.replace(/'/g, "''");
    const raw = sqliteQuery(db, `SELECT value FROM ItemTable WHERE key = '${esc}';`).trim();
    if (!raw) return null;
    try { return JSON.parse(raw); } catch { return raw; }
}
function resolveStateDb(args) {
    const ws = args?.workspace ? String(args.workspace).trim() : '';
    if (!ws) return AG_GLOBAL_STATE_DB;
    const db = path.join(AG_WORKSPACE_STORAGE, ws, 'state.vscdb');
    if (!fs.existsSync(db)) {
        throw new CommandExecutionError(`Workspace state.vscdb not found: ${db}`, 'List workspace ids with `opencli antigravity workspaces-list`.');
    }
    return db;
}

// ====== Renderer-side: storage-keys ======
cli({
    site: 'antigravity',
    name: 'storage-keys',
    access: 'read',
    description: 'List localStorage / sessionStorage keys on the Antigravity renderer (CDP).',
    domain: '127.0.0.1',
    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. Run `opencli antigravity workspaces-list` and copy the exact 'Workspace Id' value.
  2. Re-run the command with that exact id: --workspace <id>.
  3. Omit --workspace entirely to query the global state.vscdb instead.
  4. 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.

Example fix

// before
opencli antigravity state-keys --workspace /Users/me/proj
// after
opencli antigravity workspaces-list   # get e.g. '3f9c2a1e...'
opencli antigravity state-keys --workspace 3f9c2a1e...
Defensive patterns

Strategy: validation

Validate before calling

const ws = '3f9c2a1e...';
const db = `${process.env.HOME}/Library/Application Support/Antigravity/User/workspaceStorage/${ws}/state.vscdb`;
if (!require('node:fs').existsSync(db)) throw new Error(`No state.vscdb for workspace ${ws}; run 'opencli antigravity workspaces-list' to get valid ids`);

Type guard

function hasWorkspaceDb(ws) {
  if (typeof ws !== 'string' || !/^[a-f0-9]{16,}$/i.test(ws.trim())) return false;
  return require('node:fs').existsSync(
    `${process.env.HOME}/Library/Application Support/Antigravity/User/workspaceStorage/${ws.trim()}/state.vscdb`
  );
}

Try / catch

try {
  execSync(`opencli antigravity state-keys --workspace ${ws}`);
} catch (e) {
  if (/Workspace state\.vscdb not found/.test(e.message)) {
    // fall back to global DB
    execSync('opencli antigravity state-keys');
  } else throw e;
}

Prevention

When it happens

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

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

Related errors


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