jackwener/OpenCLI · error · CommandExecutionError

No snapshot repo for task ${tid}.

Error message

No snapshot repo for task ${tid}.

What it means

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.

Source

Thrown at clis/trae-solo/task-fs.js:108

cli({
    site: 'trae-solo',
    name: 'task-fs-turns',
    access: 'read',
    description: 'Show the chat-turn timeline for a Trae SOLO task as git tags (before-chat-turn-* / after-chat-turn-*).',
    domain: 'localhost',
    browser: false,
    strategy: Strategy.LOCAL,
    args: [
        { name: 'task-id', positional: true, required: true, help: 'Task UUID (folder name under snapshot/)' },
        { name: 'limit', type: 'int', required: false, default: 50 },
    ],
    columns: ['Index', 'Task Id', 'Has Snapshot', 'Has Config', 'Modified', 'Phase', 'Turn Id', 'Commit'],
    func: async (args) => {
        const tid = String(args['task-id'] || '').trim();
        if (!tid) throw new ArgumentError('task-id required');
        const repo = snapshotRepoFor(tid);
        if (!fs.existsSync(path.join(repo, '.git'))) {
            throw new CommandExecutionError(`No snapshot repo for task ${tid}.`, `Tried: ${repo}`);
        }
        // List tags + their commits, sort by commit date.
        const raw = gitInRepo(repo, ['for-each-ref', '--format=%(refname:short)|%(*objectname:short)|%(objectname:short)|%(committerdate:iso8601)', 'refs/tags']);
        const rows = raw.split('\n').filter(Boolean).map((line) => {
            const [tag, _ptr, oid, date] = line.split('|');
            const m = tag.match(/^(before|after)-chat-turn-([0-9a-f]+)(?:-(refresh))?$/);
            const phase = m ? (m[1] + (m[3] ? '/refresh' : '')) : 'misc';
            const turnId = m ? m[2] : tag;
            return { phase, turnId, oid, date };
        }).sort((a, b) => a.date.localeCompare(b.date));
        if (!rows.length) {
            throw new EmptyResultError('trae-solo task-fs-turns', `No chat-turn refs in ${repo}.`);
        }
        const limit = Number.isInteger(args.limit) && args.limit > 0 ? args.limit : 50;
        return rows.slice(0, limit).map((r, i) => ({
            Index: i + 1,
            'Task Id': '',
            'Has Snapshot': '',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the task listing command to get the exact valid task id, then retry with it
  2. Verify the snapshot directory printed in the error detail (`Tried: <path>`) exists and contains a .git folder; restore it if deleted
  3. Check that snapshotRepoFor resolves against the expected Trae data root (same user/home as the one that ran the task)
  4. Re-run the Trae task or trigger a manual snapshot so the snapshot repo gets initialized

Example fix

// before
const repo = snapshotRepoFor(tid);
if (!fs.existsSync(path.join(repo, '.git'))) {
    throw new CommandExecutionError(`No snapshot repo for task ${tid}.`, `Tried: ${repo}`);
}
// after
const repo = snapshotRepoFor(tid);
if (!fs.existsSync(path.join(repo, '.git'))) {
    console.error(`Snapshot repo missing at ${repo}; run task list to see valid ids`);
    initSnapshotRepo(repo); // or exit with the list of valid task ids
}
Defensive patterns

Strategy: validation

Validate before calling

const tid = String(args['task-id'] || '').trim();
if (!tid) throw new Error('task-id required');
const repo = snapshotRepoFor(tid);
if (!fs.existsSync(path.join(repo, '.git'))) {
    throw new Error(`Snapshot repo missing for task ${tid}: ${repo}`);
}

Type guard

const hasSnapshotRepo = (tid) => {
    const repo = snapshotRepoFor(String(tid || '').trim());
    return Boolean(repo && fs.existsSync(path.join(repo, '.git')));
};

Try / catch

try {
    const rows = await runTaskFsTurns({ 'task-id': tid });
} catch (e) {
    if (String(e.message).startsWith('No snapshot repo for task')) {
        console.warn(`Skipping ${tid}: ${e.detail || e.message}`);
        return [];
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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