jackwener/OpenCLI · error · CommandExecutionError
${label} not found: ${p}
Error message
${label} not found: ${p} What it means
assertReadable is a pre-flight guard that verifies a file (here TRAE_DB_WAL or related Trae SOLO artifacts) exists before any command touches it. The library throws this CommandExecutionError when the path does not exist on disk, because every downstream operation assumes Trae SOLO's on-disk state is present. The remedy hint tells the user to install/launch Trae SOLO once so the files are created.
Source
Thrown at clis/trae-solo/_fs.js:41
os.homedir(),
'Library/Application Support/TRAE SOLO',
);
export const TRAE_AI_AGENT_DIR = path.join(
TRAE_APP_SUPPORT,
'ModularData/ai-agent',
);
export const TRAE_SNAPSHOT_DIR = path.join(TRAE_AI_AGENT_DIR, 'snapshot');
export const TRAE_AGENTCONFIG_DIR = path.join(TRAE_AI_AGENT_DIR, 'agentconfig');
export const TRAE_WORK_MODE_PROJECTS = path.join(
TRAE_AI_AGENT_DIR,
'work-mode-projects',
);
export const TRAE_DB_WAL = path.join(TRAE_AI_AGENT_DIR, 'database.db-wal');
// Quick existence + readable check.
export function assertReadable(p, label) {
if (!fs.existsSync(p)) {
throw new CommandExecutionError(
`${label} not found: ${p}`,
'Is Trae SOLO installed and run at least once?',
);
}
}
// Parse a Markdown SKILL.md and return its YAML-style front-matter as a
// plain object, plus a one-line description (first non-frontmatter
// non-heading paragraph). Handles missing/malformed front-matter
// gracefully — returns whatever it can.
export function parseSkillMd(skillDir) {
const skillMdPath = path.join(skillDir, 'SKILL.md');
if (!fs.existsSync(skillMdPath)) {
return { name: path.basename(skillDir), description: '', tags: [] };
}
const content = fs.readFileSync(skillMdPath, 'utf-8');
const fm = {};
let body = content;View on GitHub (pinned to 49907e53dc)
Solutions
- Install and launch Trae SOLO at least once so it creates its data directory and database files
- Verify the file exists at the reported path (ls the printed path) and that you are running as the same OS user that runs Trae SOLO
- Check HOME/XDG env vars are not pointing elsewhere when running headless/CI
- If Trae is installed under a non-default location, point the library's directory config to the correct path
Example fix
// before
traeSoloCli.history.list(); // throws: db not found
// after
import fs from 'fs';
if (!fs.existsSync(TRAE_DB_WAL)) {
console.error('Launch Trae SOLO once to initialize its database.');
process.exit(1);
}
traeSoloCli.history.list(); Defensive patterns
Strategy: validation
Validate before calling
import fs from 'fs';
if (!fs.existsSync(TRAE_AI_AGENT_DIR) || !fs.existsSync(TRAE_DB_WAL)) {
throw new Error('Trae SOLO not initialized — launch it once first.');
} Type guard
function isTraeStateReady(p) {
return typeof p === 'string' && p.length > 0 && fs.existsSync(p);
} Try / catch
try {
await cmd();
} catch (e) {
if (e instanceof CommandExecutionError && /not found:/.test(e.message)) {
console.error('Run Trae SOLO once to initialize state:', e.remedy || e.message);
} else throw e;
} Prevention
- Launch Trae SOLO once on any new machine/user before scripting it
- In CI, add a setup step that verifies TRAE_DB_WAL exists and fails fast with a clear message
- Run CLI commands as the same OS user that owns the Trae data directory
When it happens
Trigger: Calling any CLI command (e.g. via readSkillConfig → assertReadable) when the file at p (such as database.db-wal under TRAE_AI_AGENT_DIR) does not exist because Trae SOLO was never installed or never run.
Common situations: Fresh machine or CI container where the Trae SOLO desktop app was never launched; wrong HOME/user (running as root or another user whose home lacks Trae data); Trae was uninstalled or its data directory cleaned; typo'd custom path passed to a function that forwards it to assertReadable.
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
- state.vscdb not found: ${db}
- settings.json not found: ${AG_SETTINGS_JSON}
- state.vscdb not found: ${TRAE_GLOBAL_STATE_DB}
- extensions.json not found: ${TRAE_EXTENSIONS_JSON}
- Verify command returned no metric for baseline
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1a78a95b549f6e1e.
Report an issue: GitHub.