{"record":{"id":"1a78a95b549f6e1e","repo":"jackwener/OpenCLI","slug":"label-not-found-p","errorCode":null,"errorMessage":"${label} not found: ${p}","messagePattern":"(.+?) not found: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/trae-solo/_fs.js","lineNumber":41,"sourceCode":"    os.homedir(),\n    'Library/Application Support/TRAE SOLO',\n);\nexport const TRAE_AI_AGENT_DIR = path.join(\n    TRAE_APP_SUPPORT,\n    'ModularData/ai-agent',\n);\nexport const TRAE_SNAPSHOT_DIR = path.join(TRAE_AI_AGENT_DIR, 'snapshot');\nexport const TRAE_AGENTCONFIG_DIR = path.join(TRAE_AI_AGENT_DIR, 'agentconfig');\nexport const TRAE_WORK_MODE_PROJECTS = path.join(\n    TRAE_AI_AGENT_DIR,\n    'work-mode-projects',\n);\nexport const TRAE_DB_WAL = path.join(TRAE_AI_AGENT_DIR, 'database.db-wal');\n\n// Quick existence + readable check.\nexport function assertReadable(p, label) {\n    if (!fs.existsSync(p)) {\n        throw new CommandExecutionError(\n            `${label} not found: ${p}`,\n            'Is Trae SOLO installed and run at least once?',\n        );\n    }\n}\n\n// Parse a Markdown SKILL.md and return its YAML-style front-matter as a\n// plain object, plus a one-line description (first non-frontmatter\n// non-heading paragraph). Handles missing/malformed front-matter\n// gracefully — returns whatever it can.\nexport function parseSkillMd(skillDir) {\n    const skillMdPath = path.join(skillDir, 'SKILL.md');\n    if (!fs.existsSync(skillMdPath)) {\n        return { name: path.basename(skillDir), description: '', tags: [] };\n    }\n    const content = fs.readFileSync(skillMdPath, 'utf-8');\n    const fm = {};\n    let body = content;","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trae-solo/_fs.js#L23-L59","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ntraeSoloCli.history.list(); // throws: db not found\n// after\nimport fs from 'fs';\nif (!fs.existsSync(TRAE_DB_WAL)) {\n  console.error('Launch Trae SOLO once to initialize its database.');\n  process.exit(1);\n}\ntraeSoloCli.history.list();","handlingStrategy":"validation","validationCode":"import fs from 'fs';\nif (!fs.existsSync(TRAE_AI_AGENT_DIR) || !fs.existsSync(TRAE_DB_WAL)) {\n  throw new Error('Trae SOLO not initialized — launch it once first.');\n}","typeGuard":"function isTraeStateReady(p) {\n  return typeof p === 'string' && p.length > 0 && fs.existsSync(p);\n}","tryCatchPattern":"try {\n  await cmd();\n} catch (e) {\n  if (e instanceof CommandExecutionError && /not found:/.test(e.message)) {\n    console.error('Run Trae SOLO once to initialize state:', e.remedy || e.message);\n  } else throw e;\n}","preventionTips":["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"],"tags":["filesystem","missing-file","trae-solo","prerequisite"],"backgroundTag":"file-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}