jackwener/OpenCLI · error · ArgumentError
task-id required
Error message
task-id required
What it means
An ArgumentError from the task tag/history command when the positional --task-id argument is missing or whitespace-only after trimming. The task id is required to locate the snapshot repo (snapshotRepoFor), so validation fails before any git access.
Source
Thrown at clis/trae-solo/task-fs.js:105
});
// -------- task-fs-turns --------
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) => ({View on GitHub (pinned to 49907e53dc)
Solutions
- Pass the task UUID positionally, exactly as listed by `opencli trae-solo task-fs-list` (folder name under snapshot/).
- Guard scripts: [ -n "$TID" ] || exit 1 before calling.
- Check the command's arg spec — supply it in the accepted form (positional vs --task-id flag).
Example fix
// before TID=""; opencli trae-solo task-tags "$TID" // after opencli trae-solo task-fs-list # copy Task Id TID=<task-uuid>; [ -n "$TID" ] && opencli trae-solo task-tags "$TID"
Defensive patterns
Strategy: validation
Validate before calling
const tid = String(args['task-id'] || '').trim();
if (!tid) { console.error('usage: task-tags <task-uuid>'); process.exit(2); }
if (!fs.existsSync(path.join(snapshotRepoFor(tid), '.git'))) throw new Error(`no snapshot repo for ${tid}`); Type guard
function hasTaskId(args) { return typeof args['task-id'] === 'string' && args['task-id'].trim().length > 0; } Try / catch
try {
await taskTags(args);
} catch (e) {
if (/^task-id required$/.test(e.message)) console.error('Pass the UUID from task-fs-list as a positional argument');
throw e;
} Prevention
- Copy task ids from task-fs-list output, never retype
- Check empty shell variables in scripts before invoking
- Use the positional form expected by the command spec
- Pre-check the snapshot repo (.git exists) to give a clearer failure than a bare git error
When it happens
Trigger: Invoking the command without the positional task-id, with an empty string, or in a script where the id variable was empty.
Common situations: Forgot to paste the UUID; variable interpolation in a script yielded empty; confusion between positional and named flags (passing --task-id where a bare positional is expected or vice versa).
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- keyword must not be empty
- <from> station must not be empty
- <to> station must not be empty
- who 不能为空
- key is required
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/f54880084ab0696a.
Report an issue: GitHub.