jackwener/OpenCLI · error · CommandExecutionError
Workspace state.vscdb not found: ${db}
Error message
Workspace state.vscdb not found: ${db} What it means
resolveStateDb builds a path <TRAE_WORKSPACE_STORAGE>/<workspace-id>/state.vscdb and throws when that file does not exist. It only validates existence when a --workspace argument is supplied; the global DB is returned unchecked. The error means the supplied workspace id does not correspond to an actual workspaceStorage folder.
Source
Thrown at clis/trae-solo/state-fs.js:39
ArgumentError,
CommandExecutionError,
EmptyResultError,
} from '@jackwener/opencli/errors';
import {
TRAE_GLOBAL_STATE_DB,
TRAE_WORKSPACE_STORAGE,
listKeys,
getValue,
} from './_state.js';
// Resolve the actual state.vscdb to read. With no --workspace, uses the
// global state DB. With --workspace <id>, uses that workspaceStorage DB.
function resolveStateDb(args) {
const ws = args.workspace ? String(args.workspace).trim() : '';
if (!ws) return TRAE_GLOBAL_STATE_DB;
const db = path.join(TRAE_WORKSPACE_STORAGE, ws, 'state.vscdb');
if (!fs.existsSync(db)) {
throw new CommandExecutionError(
`Workspace state.vscdb not found: ${db}`,
'List valid workspace ids with `opencli trae-solo workspaces-list`.',
);
}
return db;
}
// -------- state-keys --------
cli({
site: 'trae-solo',
name: 'state-keys',
access: 'read',
description: 'List all keys present in Trae SOLO\'s globalStorage state.vscdb (VSCode-style UI/agent state). Pass --workspace <ws-id> to query a per-workspace DB instead. Use state-get to read a specific value. (See renderer storage-keys for browser-side LS/SS.)',
domain: 'localhost',
browser: false,
strategy: Strategy.LOCAL,
args: [
{ name: 'filter', required: false, help: 'Case-insensitive substring filter over keys' },View on GitHub (pinned to 49907e53dc)
Solutions
- Run `opencli trae-solo workspaces-list` and copy an exact, currently valid workspace id.
- Confirm the file exists at <TRAE_WORKSPACE_STORAGE>/<id>/state.vscdb (ls the directory) before passing --workspace.
- Omit --workspace to query the global TRAE_GLOBAL_STATE_DB instead.
- If the workspace was removed, re-open it once in Trae so its state.vscdb is recreated.
Example fix
// before opencli trae-solo state-get --workspace abc123 // after opencli trae-solo workspaces-list # pick a valid id opencli trae-solo state-get --workspace 3f9c... # exact folder name
Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs'), path = require('path');
const db = path.join(TRAE_WORKSPACE_STORAGE, ws, 'state.vscdb');
if (!ws.trim()) throw new Error('workspace id required');
if (!fs.existsSync(db)) throw new Error(`workspace db missing: ${db} — run workspaces-list`); Type guard
function isValidWorkspaceId(ws) { return typeof ws === 'string' && /^[A-Za-z0-9-]{8,}$/.test(ws.trim()); } Try / catch
try {
const db = resolveStateDb(args);
// ...
} catch (e) {
if (/state.vscdb not found/.test(e.message)) {
console.error('Run: opencli trae-solo workspaces-list');
}
throw e;
} Prevention
- Copy workspace ids verbatim from workspaces-list, never type them by hand
- Check the state.vscdb path exists before calling any state command with --workspace
- Refresh the id list after Trae updates or storage cleanups
- Omit --workspace when global state is what you need
When it happens
Trigger: Calling any trae-solo state command (state-keys, state-get, etc.) with --workspace set to an id whose folder has no state.vscdb, a mistyped/truncated id, or a workspace that was deleted from workspaceStorage.
Common situations: Typo or partial copy-paste of the workspace UUID; stale id from an old workspaces-list after Trae cleaned storage; pointing the CLI at a machine/user profile where the workspace never existed; Trae version change moving workspaceStorage.
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
- File not found: ${path}
- File must be a readable text file: ${path}
- File could not be read: ${path}
- target appeared during reservation
- MiniMax music cannot reserve output file ${target}: ${error?
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/2ebbe740d5d6fd4b.
Report an issue: GitHub.