jackwener/OpenCLI · error · CommandExecutionError
state.vscdb not found: ${db}
Error message
state.vscdb not found: ${db} What it means
sqliteQuery in storage.js checks fs.existsSync on the target SQLite DB (typically ~/.antigravity/globalStorage/state.vscdb) before shelling out to /usr/bin/sqlite3; if the file is absent it throws a CommandExecutionError with a hint asking whether Antigravity has ever been run. The CLI reads Antigravity's internal state from this DB.
Source
Thrown at clis/antigravity/storage.js:44
'Kind',
'Path',
'Workspace Id',
'Folder',
'Modified',
'Field',
'Value',
];
// ====== Path helpers ======
const AG_APP_SUPPORT = path.join(os.homedir(), 'Library/Application Support/Antigravity');
const AG_USER_DIR = path.join(AG_APP_SUPPORT, 'User');
const AG_GLOBAL_STATE_DB = path.join(AG_USER_DIR, 'globalStorage/state.vscdb');
const AG_WORKSPACE_STORAGE = path.join(AG_USER_DIR, 'workspaceStorage');
const AG_SETTINGS_JSON = path.join(AG_USER_DIR, 'settings.json');
function sqliteQuery(db, sql) {
if (!fs.existsSync(db)) {
throw new CommandExecutionError(`state.vscdb not found: ${db}`, 'Has Antigravity been run at least once?');
}
try {
return execFileSync('/usr/bin/sqlite3', [db, sql], { encoding: 'utf-8', maxBuffer: 64 * 1024 * 1024 });
} catch (e) {
throw new CommandExecutionError(
`sqlite3 failed on ${path.basename(db)}: ${e.message}`,
'The DB may be locked by a running Antigravity instance. Try closing it or wait a few seconds.',
);
}
}
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;View on GitHub (pinned to 49907e53dc)
Solutions
- Launch Antigravity once so it creates its profile and state.vscdb
- Verify the resolved path exists: ls ~/.antigravity/globalStorage/state.vscdb
- Check/correct the AG_USER_DIR env var or path option pointing to the profile
- Run the CLI as the same user that runs Antigravity (avoid sudo/home mismatch)
- Pass an explicit db path if your profile is in a non-default location
Example fix
// before AG_USER_DIR=/wrong/path node serve.js // after export AG_USER_DIR=$HOME/.antigravity # or wherever the profile lives node serve.js
Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs');
const db = process.env.AG_USER_DIR + '/globalStorage/state.vscdb';
if (!fs.existsSync(db)) {
throw new Error(`state.vscdb missing at ${db}; launch Antigravity once first`);
} Type guard
function dbExists(dbPath) {
return typeof dbPath === 'string' && fs.existsSync(dbPath) && fs.statSync(dbPath).isFile();
} Try / catch
try {
const rows = storageOut();
} catch (err) {
if (err.message.startsWith('state.vscdb not found')) {
console.error('Launch Antigravity once, or set AG_USER_DIR to its profile dir');
}
throw err;
} Prevention
- Run Antigravity at least once before using storage commands
- Run the CLI as the same user/home as Antigravity
- Verify AG_USER_DIR points to the real profile directory
- Use explicit db paths for non-default installs
When it happens
Trigger: Any storage subcommand (out/raw) calling sqliteQuery with a db path that doesn't exist on disk.
Common situations: Antigravity never launched on this machine so no profile/globalStorage exists; AG_USER_DIR env var points to the wrong/custom directory; different user/home when running under a service or sudo; typo'd explicit --db path; platform migration where the profile lives elsewhere.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- sqlite3 failed on ${path.basename(db)}: ${e.message}
- Workspace state.vscdb not found: ${db}
- antigravity state-keys: No keys match "${flt}".
- Key not found: ${key}
- workspaceStorage not found: ${AG_WORKSPACE_STORAGE}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/2c09a38cd0075cc1.
Report an issue: GitHub.