jackwener/OpenCLI · error · CommandExecutionError

No tag matched turn "${t}".

Error message

No tag matched turn "${t}".

What it means

This CommandExecutionError is thrown by the task-fs files command when a specific `turn` argument is given but no tag in the snapshot repo contains that turn string. The command filters refs/tags by substring match on the turn id and picks an after-chat-turn-* tag first, then any other match; if the filtered list is empty it throws.

Source

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

        { name: 'turn', required: false, help: 'Specific turn id (omit for latest after-chat-turn)' },
        { name: 'limit', type: 'int', required: false, default: 50 },
    ],
    columns: ['Mode', 'Path', 'Size'],
    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}`);
        }
        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. Run the turns listing command for the task to see the exact valid turn ids and use one verbatim
  2. Use the short turn id (as shown in the Turn Id column) rather than the full sha
  3. Omit --turn to get the latest after-chat-turn snapshot instead
  4. Confirm you are querying the snapshot repo of the correct task

Example fix

// before
trae-solo task-fs files --task-id t1 --turn 9f8c2ab1d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9
// after
trae-solo task-fs turns --task-id t1        # shows Turn Id like 9f8c2ab1
trae-solo task-fs files --task-id t1 --turn 9f8c2ab1
Defensive patterns

Strategy: validation

Validate before calling

const tags = gitInRepo(repo, ['for-each-ref', '--format=%(refname:short)', 'refs/tags']).split('\n');
if (!tags.some((t) => t.includes(turnId))) {
    throw new Error(`Turn ${turnId} has no snapshot tag; valid tags: ${tags.filter(Boolean).join(', ')}`);
}

Try / catch

try {
    const rows = await runTaskFsFiles({ 'task-id': tid, turn: turnId });
} catch (e) {
    if (/No tag matched turn/.test(e.message)) {
        const turns = await runTaskFsTurns({ 'task-id': tid });
        throw new Error(`Unknown turn ${turnId}. Valid turns: ${turns.map((r) => r['Turn Id']).join(', ')}`);
    }
    throw e;
}

Prevention

When it happens

Trigger: Passing `--turn <id>` where no tag name includes that id; turn id format mismatch (e.g., full 40-char sha vs the short hex id used in tag names); asking for a turn before any snapshot for that turn was tagged.

Common situations: Copy-pasting the full commit sha instead of the short turn id; turn id from a different task's repo; snapshots only exist for other turns; referring to a refresh variant that was never created.

Related errors


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