jackwener/OpenCLI · error · CliError

CONFIG

CONFIG

Error message

task uuid required

What it means

This CONFIG error is thrown by the ONES worklog command (clis/ones/worklog.js) when the task UUID argument is missing or blank. A worklog entry must be attached to a specific work item, identified by its uuid; without it the command cannot proceed.

Source

Thrown at clis/ones/worklog.js:152

        },
        {
            name: 'note',
            type: 'str',
            required: false,
            help: 'Optional note (written to description/desc)',
        },
        {
            name: 'owner',
            type: 'str',
            required: false,
            help: 'Owner user UUID (defaults to current logged-in user)',
        },
    ],
    columns: ['task', 'date', 'hours', 'owner', 'endpoint'],
    func: async (page, kwargs) => {
        const taskId = String(kwargs.task ?? '').trim();
        if (!taskId) {
            throw new CliError('CONFIG', 'task uuid required', 'Pass the work item uuid from opencli ones my-tasks or the URL.');
        }
        const team = kwargs.team?.trim() ||
            process.env.ONES_TEAM_UUID?.trim() ||
            process.env.ONES_TEAM_ID?.trim();
        if (!team) {
            throw new CliError('CONFIG', 'team UUID required', 'Pass --team or set ONES_TEAM_UUID (from …/team/<team>/…).');
        }
        const hoursHuman = Number(String(kwargs.hours ?? '').replace(/,/g, ''));
        if (!Number.isFinite(hoursHuman) || hoursHuman <= 0 || hoursHuman > 1000) {
            throw new CliError('CONFIG', 'hours must be a positive number (hours)', 'Example: opencli ones worklog <taskUUID> 2 --team <teamUUID>');
        }
        const dateArg = kwargs.date?.trim();
        const dateStr = dateArg || todayLocalYmd();
        if (!validateYmd(dateStr)) {
            throw new CliError('CONFIG', 'invalid --date', 'Use YYYY-MM-DD, e.g. 2026-03-24.');
        }
        const note = String(kwargs.note ?? '').trim();
        const rawManhour = hoursToOnesManhourRaw(hoursHuman);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass the work item uuid: opencli ones worklog <taskUUID> <hours> --team <teamUUID>.
  2. Find the uuid via `opencli ones my-tasks` or copy it from the ONES task URL …/task/<id>.
  3. Fix the calling script so it forwards the task argument.

Example fix

// before
opencli ones worklog 2 --team T1        // missing task uuid
// after
opencli ones worklog 3fa2b1c9d8e7f601 2 --team T1
Defensive patterns

Strategy: validation

Validate before calling

const taskId = String(kwargs.task ?? '').trim();
if (!taskId) throw new Error('worklog requires a task uuid (see opencli ones my-tasks)');

Type guard

function hasTask(a) { return typeof a.task === 'string' && a.task.trim().length > 0; }

Try / catch

try {
  await opencli.ones.worklog({ task: taskId, hours, team });
} catch (e) {
  if (e.code === 'CONFIG' && e.message === 'task uuid required') { console.error('Pass the task uuid from my-tasks or the URL.'); }
  else throw e;
}

Prevention

When it happens

Trigger: Running `opencli ones worklog` without the task uuid positional/argument, or passing only whitespace (kwargs.task trims to empty).

Common situations: Users try to log time without knowing the task id; automation scripts omit the task parameter; users pass a task number/title instead of the uuid.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


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