{"record":{"id":"ca88f0f44dc63bb4","repo":"jackwener/OpenCLI","slug":"no-snapshot-repo-for-task-tid","errorCode":null,"errorMessage":"No snapshot repo for task ${tid}.","messagePattern":"No snapshot repo for task (.+?)\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/trae-solo/task-fs.js","lineNumber":108,"sourceCode":"cli({\n    site: 'trae-solo',\n    name: 'task-fs-turns',\n    access: 'read',\n    description: 'Show the chat-turn timeline for a Trae SOLO task as git tags (before-chat-turn-* / after-chat-turn-*).',\n    domain: 'localhost',\n    browser: false,\n    strategy: Strategy.LOCAL,\n    args: [\n        { name: 'task-id', positional: true, required: true, help: 'Task UUID (folder name under snapshot/)' },\n        { name: 'limit', type: 'int', required: false, default: 50 },\n    ],\n    columns: ['Index', 'Task Id', 'Has Snapshot', 'Has Config', 'Modified', 'Phase', 'Turn Id', 'Commit'],\n    func: async (args) => {\n        const tid = String(args['task-id'] || '').trim();\n        if (!tid) throw new ArgumentError('task-id required');\n        const repo = snapshotRepoFor(tid);\n        if (!fs.existsSync(path.join(repo, '.git'))) {\n            throw new CommandExecutionError(`No snapshot repo for task ${tid}.`, `Tried: ${repo}`);\n        }\n        // List tags + their commits, sort by commit date.\n        const raw = gitInRepo(repo, ['for-each-ref', '--format=%(refname:short)|%(*objectname:short)|%(objectname:short)|%(committerdate:iso8601)', 'refs/tags']);\n        const rows = raw.split('\\n').filter(Boolean).map((line) => {\n            const [tag, _ptr, oid, date] = line.split('|');\n            const m = tag.match(/^(before|after)-chat-turn-([0-9a-f]+)(?:-(refresh))?$/);\n            const phase = m ? (m[1] + (m[3] ? '/refresh' : '')) : 'misc';\n            const turnId = m ? m[2] : tag;\n            return { phase, turnId, oid, date };\n        }).sort((a, b) => a.date.localeCompare(b.date));\n        if (!rows.length) {\n            throw new EmptyResultError('trae-solo task-fs-turns', `No chat-turn refs in ${repo}.`);\n        }\n        const limit = Number.isInteger(args.limit) && args.limit > 0 ? args.limit : 50;\n        return rows.slice(0, limit).map((r, i) => ({\n            Index: i + 1,\n            'Task Id': '',\n            'Has Snapshot': '',","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/trae-solo/task-fs.js#L90-L126","documentation":"This CommandExecutionError is thrown by the task-fs turns listing command when the git snapshot repository computed for a task id does not exist on disk. The CLI resolves the path via snapshotRepoFor(tid) and checks path.join(repo, '.git') with fs.existsSync before running any git commands. It means no snapshot was ever created for that task id, or the id was mistyped.","triggerScenarios":"Running the task-fs-turns command with a --task-id whose snapshot directory (from snapshotRepoFor) does not exist or lacks a .git directory; passing a trimmed-empty or wrong task id; snapshot directory moved or cleaned between task creation and listing.","commonSituations":"Typo in the task id; snapshot repos pruned by a cleanup job or manual rm -rf; running the CLI on a different machine or under a different user/home so the snapshot root resolves elsewhere; Trae task created but never reached the point where an initial snapshot commit was made.","solutions":["Re-run the task listing command to get the exact valid task id, then retry with it","Verify the snapshot directory printed in the error detail (`Tried: <path>`) exists and contains a .git folder; restore it if deleted","Check that snapshotRepoFor resolves against the expected Trae data root (same user/home as the one that ran the task)","Re-run the Trae task or trigger a manual snapshot so the snapshot repo gets initialized"],"exampleFix":"// before\nconst repo = snapshotRepoFor(tid);\nif (!fs.existsSync(path.join(repo, '.git'))) {\n    throw new CommandExecutionError(`No snapshot repo for task ${tid}.`, `Tried: ${repo}`);\n}\n// after\nconst repo = snapshotRepoFor(tid);\nif (!fs.existsSync(path.join(repo, '.git'))) {\n    console.error(`Snapshot repo missing at ${repo}; run task list to see valid ids`);\n    initSnapshotRepo(repo); // or exit with the list of valid task ids\n}","handlingStrategy":"validation","validationCode":"const tid = String(args['task-id'] || '').trim();\nif (!tid) throw new Error('task-id required');\nconst repo = snapshotRepoFor(tid);\nif (!fs.existsSync(path.join(repo, '.git'))) {\n    throw new Error(`Snapshot repo missing for task ${tid}: ${repo}`);\n}","typeGuard":"const hasSnapshotRepo = (tid) => {\n    const repo = snapshotRepoFor(String(tid || '').trim());\n    return Boolean(repo && fs.existsSync(path.join(repo, '.git')));\n};","tryCatchPattern":"try {\n    const rows = await runTaskFsTurns({ 'task-id': tid });\n} catch (e) {\n    if (String(e.message).startsWith('No snapshot repo for task')) {\n        console.warn(`Skipping ${tid}: ${e.detail || e.message}`);\n        return [];\n    }\n    throw e;\n}","preventionTips":["Always fetch task ids from the task listing command rather than typing them from memory","Check for the .git directory before invoking snapshot-backed commands","Do not prune snapshot directories while tasks are still active","Run the CLI as the same user/machine that produced the snapshots"],"tags":["filesystem","git","missing-snapshot"],"backgroundTag":"snapshot-repo-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}