jackwener/OpenCLI · error · CommandExecutionError

No after-chat-turn tags found.

Error message

No after-chat-turn tags found.

What it means

This CommandExecutionError is thrown by the task-fs files command when no `turn` argument was supplied and the repo contains no tags starting with `after-chat-turn-`. The command sorts tags by committerdate and takes the newest matching ref; with zero matches it cannot proceed.

Source

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

        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}`);
        }
        let ref;
        if (args.turn) {
            const t = String(args.turn).trim();
            // Prefer after-* if present; else before-*.
            const tagListRaw = gitInRepo(repo, ['for-each-ref', '--format=%(refname:short)', 'refs/tags']);
            const tags = tagListRaw.split('\n').filter((x) => x.includes(t));
            ref = tags.find((x) => x.startsWith('after-chat-turn-')) || tags[0];
            if (!ref) throw new CommandExecutionError(`No tag matched turn "${t}".`, '');
        } else {
            // Pick the latest after-chat-turn ref.
            const raw = gitInRepo(repo, ['for-each-ref', '--sort=-committerdate', '--format=%(refname:short)', 'refs/tags']);
            ref = raw.split('\n').find((t) => t.startsWith('after-chat-turn-'));
            if (!ref) throw new CommandExecutionError('No after-chat-turn tags found.', '');
        }
        const tree = gitInRepo(repo, ['ls-tree', '-r', '-l', ref]);
        const rows = tree.split('\n').filter(Boolean).map((line) => {
            const parts = line.split(/\s+/);
            // mode  type  oid  size  path
            return { mode: parts[0], oid: parts[2], size: parts[3], pth: parts.slice(4).join(' ') };
        });
        const limit = Number.isInteger(args.limit) && args.limit > 0 ? args.limit : 50;
        return rows.slice(0, limit).map((r) => ({ Mode: r.mode, Path: r.pth, Size: r.size }));
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass an explicit --turn <id> to pick a before-chat-turn tag instead of relying on the latest-after default
  2. Check `git -C <repo> tag -l` to see what tags exist and use one via --turn
  3. Re-run the Trae task to completion so an after-chat-turn snapshot is captured
  4. If tag naming changed in a newer version, align the CLI and snapshot producer versions

Example fix

// before
let ref = raw.split('\n').find((t) => t.startsWith('after-chat-turn-'));
if (!ref) throw new CommandExecutionError('No after-chat-turn tags found.', '');
// after
let ref = raw.split('\n').find((t) => t.startsWith('after-chat-turn-'))
       || raw.split('\n').find((t) => t.startsWith('before-chat-turn-')); // fallback
if (!ref) throw new CommandExecutionError('No chat-turn tags found.', '');
Defensive patterns

Strategy: fallback

Validate before calling

const tags = gitInRepo(repo, ['for-each-ref', '--format=%(refname:short)', 'refs/tags']).split('\n').filter(Boolean);
if (!tags.some((t) => t.startsWith('after-chat-turn-'))) {
    console.warn('No after-chat-turn tags; specify --turn to use a before-* tag.');
}

Try / catch

try {
    const rows = await runTaskFsFiles({ 'task-id': tid });
} catch (e) {
    if (/No after-chat-turn tags found/.test(e.message)) {
        // fall back to an explicit before-chat-turn tag
        return runTaskFsFiles({ 'task-id': tid, turn: latestBeforeTurnId(repo) });
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling the task-fs files command without --turn on a snapshot repo that has only before-chat-turn-* tags (a turn started but never completed), or a repo with no tags at all, or tags created with a different naming convention.

Common situations: A turn failed mid-way so only the before snapshot exists; querying a task that never completed a chat turn; a version change in snapshot tag naming (snapshot tool no longer uses the after-chat-turn- prefix).

Related errors


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