jackwener/OpenCLI · error · CommandExecutionError

workspaceStorage not found: ${TRAE_WORKSPACE_STORAGE}

Error message

workspaceStorage not found: ${TRAE_WORKSPACE_STORAGE}

What it means

This CommandExecutionError is thrown by the workspaces-list command when the Trae workspaceStorage directory (constant TRAE_WORKSPACE_STORAGE) does not exist on disk. The CLI checks fs.existsSync on that root before enumerating per-workspace directories, failing fast when Trae has never stored workspace data at that path.

Source

Thrown at clis/trae-solo/workspaces-fs.js:36

    resolveWorkspaceJson,
} from './_state.js';

// -------- workspaces-list --------
cli({
    site: 'trae-solo',
    name: 'workspaces-list',
    access: 'read',
    description: 'List Trae SOLO workspaceStorage entries (~/Library/.../TRAE SOLO/User/workspaceStorage/<uuid>/), resolving each workspace.json to its single-folder path or multi-folder workspace target. Works while Trae is closed.',
    domain: 'localhost',
    browser: false,
    strategy: Strategy.LOCAL,
    args: [
        { name: 'limit', type: 'int', required: false, default: 100 },
    ],
    columns: ['Index', 'Workspace Id', 'Kind', 'Target', 'Modified', 'Id', 'Version', 'Source', 'Installed'],
    func: async (args) => {
        if (!fs.existsSync(TRAE_WORKSPACE_STORAGE)) {
            throw new CommandExecutionError(
                `workspaceStorage not found: ${TRAE_WORKSPACE_STORAGE}`,
                '',
            );
        }
        const dirs = fs.readdirSync(TRAE_WORKSPACE_STORAGE).filter((n) => {
            const full = path.join(TRAE_WORKSPACE_STORAGE, n);
            return fs.statSync(full).isDirectory();
        });
        if (!dirs.length) {
            throw new EmptyResultError('trae-solo workspaces-list', 'No workspace storage entries.');
        }
        const rows = dirs.map((id) => {
            const dir = path.join(TRAE_WORKSPACE_STORAGE, id);
            const wj = path.join(dir, 'workspace.json');
            const resolved = resolveWorkspaceJson(wj);
            const mtime = fs.statSync(dir).mtimeMs;
            return { id, kind: resolved.kind, target: resolved.target, mtime };
        }).sort((a, b) => b.mtime - a.mtime);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Launch Trae SOLO once and open a workspace so workspaceStorage gets created, then retry
  2. Verify TRAE_WORKSPACE_STORAGE points at the actual storage dir (compare with the path printed in the error) and correct it if wrong
  3. Check that the user profile running the command matches the one running Trae (HOME / APPDATA differences)
  4. Locate the real storage dir per Trae docs (e.g., Application Support / %APPDATA%) and update the constant

Example fix

// before
const TRAE_WORKSPACE_STORAGE = path.join(os.homedir(), '.trae', 'workspaceStorage');
// after
const candidates = [path.join(os.homedir(), '.trae', 'workspaceStorage'),
                    path.join(os.homedir(), 'Library', 'Application Support', 'Trae', 'User', 'workspaceStorage'),
                    path.join(process.env.APPDATA || '', 'Trae', 'User', 'workspaceStorage')];
const TRAE_WORKSPACE_STORAGE = candidates.find((p) => fs.existsSync(p));
Defensive patterns

Strategy: fallback

Validate before calling

if (!fs.existsSync(TRAE_WORKSPACE_STORAGE)) {
    console.warn(`workspaceStorage missing at ${TRAE_WORKSPACE_STORAGE}; launch Trae first.`);
}

Try / catch

try {
    const rows = await runWorkspacesList();
} catch (e) {
    if (/workspaceStorage not found/.test(e.message)) {
        console.warn('Trae workspaceStorage does not exist yet; nothing to list.');
        return [];
    }
    throw e;
}

Prevention

When it happens

Trigger: Running the command on a machine where Trae SOLO was never launched; TRAE_WORKSPACE_STORAGE pointing at a custom/wrong location; a Trae update changing the storage path layout; running under a different OS user whose home directory differs.

Common situations: Fresh machine or CI container without Trae history; Trae portable/Insiders build with a different data dir; sudo vs normal user mismatch redirecting the home-based path; profile path changes after an upgrade.

Related errors


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