jackwener/OpenCLI · error · CommandExecutionError
Key not found: ${key}
Error message
Key not found: ${key} What it means
state-get queried the resolved state.vscdb's ItemTable for the given key; getValue() returned null (empty query result), meaning no row with that exact key exists in the global or workspace DB. A CommandExecutionError names the missing key. Keys must match byte-for-byte — no prefix or fuzzy matching is performed.
Source
Thrown at clis/antigravity/storage.js:239
site: 'antigravity',
name: 'state-get',
access: 'read',
description: 'Read one value from Antigravity\'s state.vscdb. Pass --workspace <id> for per-workspace.',
domain: 'localhost',
strategy: Strategy.LOCAL,
browser: false,
args: [
{ name: 'key', positional: true, required: true, help: 'Storage key name' },
{ name: 'workspace', required: false, help: 'Workspace id (from workspaces-list) to query per-workspace DB' },
{ name: 'max-bytes', type: 'int', required: false, default: 8000, help: 'Truncate value to this many chars' },
],
columns: STORAGE_COLUMNS,
func: async (args) => {
const key = String(args?.key || '').trim();
if (!key) throw new ArgumentError('key', 'is required');
const db = resolveStateDb(args);
const val = getValue(db, key);
if (val === null) throw new CommandExecutionError(`Key not found: ${key}`, '');
const max = Number.isInteger(args['max-bytes']) && args['max-bytes'] > 0 ? args['max-bytes'] : 8000;
const valStr = typeof val === 'string' ? val : JSON.stringify(val, null, 2);
const truncated = valStr.length > max;
return [
{ Field: 'Key', Value: key },
{ Field: 'Type', Value: typeof val === 'string' ? 'string' : (Array.isArray(val) ? 'array' : typeof val) },
{ Field: 'Size', Value: `${valStr.length} chars${truncated ? ' (truncated)' : ''}` },
{ Field: 'Value', Value: truncated ? valStr.slice(0, max) + '\n...(truncated)' : valStr },
];
},
});
// ====== FS-side: recent-paths ======
cli({
site: 'antigravity',
name: 'recent-paths',
access: 'read',
description: 'Show Antigravity\'s recently-opened folders/files (history.recentlyOpenedPathsList).',View on GitHub (pinned to 49907e53dc)
Solutions
- List exact keys first: `opencli antigravity state-keys` (optionally --filter substring).
- Copy the key verbatim from state-keys output — matching is exact.
- Retry with/without --workspace to check the other database.
- If the value is a user setting, use `opencli antigravity settings-read` instead.
Example fix
// before opencli antigravity state-get recentlyOpenedPathsList // after opencli antigravity state-keys --filter recently opencli antigravity state-get history.recentlyOpenedPathsList
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify the exact key exists in the target DB before reading
const out = execSync('opencli antigravity state-keys' + (ws ? ` --workspace ${ws}` : ''), {encoding:'utf8'});
if (!out.includes('history.recentlyOpenedPathsList')) throw new Error('key not present in this DB; check state-keys output for exact name'); Type guard
function keyInListing(listingOutput, key) {
return String(listingOutput).split('\n').some((row) => row.split(/\s{2,}/).includes(key));
} Try / catch
try {
run(`opencli antigravity state-get ${key}`);
} catch (e) {
if (/^Key not found: /.test(e.message)) {
run(`opencli antigravity state-get ${key} --workspace ${ws}`); // try workspace DB
} else throw e;
} Prevention
- Copy keys verbatim from state-keys output — matching is exact, no fuzzy/prefix lookup.
- Check both global and --workspace DBs; key sets differ.
- Don't confuse settings.json keys (settings-read) with ItemTable keys (state-get).
- Key names can change between Antigravity versions — re-list rather than hardcoding.
When it happens
Trigger: `opencli antigravity state-get wrongKey`, reading a key that only exists in the workspace DB while running against the global DB (or vice versa), or key names that changed across Antigravity versions.
Common situations: Confusing settings.json keys (file-based) with ItemTable keys (SQLite), missing the extension/vendor prefix on the key, or querying a per-workspace DB via --workspace when the record lives globally.
Related errors
- Key not found in ${store}: ${key}
- state.vscdb not found: ${db}
- sqlite3 failed on ${path.basename(db)}: ${e.message}
- antigravity state-keys: No keys match "${flt}".
- Could not find Antigravity input box
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/d861681f93dd16d9.
Report an issue: GitHub.