jackwener/OpenCLI · error · CliError

FETCH_ERROR

FETCH_ERROR

Error message

ONES task info: ${hint}

What it means

This FETCH_ERROR is thrown when the ONES `team/<team>/task/<id>/info` endpoint returns a payload without a string `uuid` field, meaning the task could not be fetched/verified. The library embeds the API's `reason` (if present) or a generic hint into the message. It guards against silently returning a malformed task object.

Source

Thrown at clis/ones/task.js:52

    columns: ['uuid', 'summary', 'number', 'status_uuid', 'assign', 'owner', 'project_uuid', 'updated'],
    func: async (page, kwargs) => {
        const id = String(kwargs.id ?? '').trim();
        if (!id) {
            throw new CliError('CONFIG', 'task id required', 'Pass the work item uuid from the URL path …/task/<id>');
        }
        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', 'Use --team <teamUUID> or set ONES_TEAM_UUID (from …/team/<team>/…).');
        }
        const path = `team/${team}/task/${encodeURIComponent(id)}/info`;
        const data = (await onesFetchInPage(page, path, { method: 'GET' }));
        if (typeof data.uuid !== 'string') {
            const hint = typeof data.reason === 'string'
                ? data.reason
                : 'Use -f json to inspect response; check id length (often 16) and team.';
            throw new CliError('FETCH_ERROR', `ONES task info: ${hint}`, 'Confirm task uuid and team match the browser URL.');
        }
        return [
            {
                uuid: String(data.uuid),
                summary: String(data.summary ?? ''),
                number: data.number != null ? String(data.number) : '',
                status_uuid: String(data.status_uuid ?? ''),
                assign: String(data.assign ?? ''),
                owner: String(data.owner ?? ''),
                project_uuid: String(data.project_uuid ?? ''),
                updated: formatStamp(data.server_update_stamp),
            },
        ];
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-check the task uuid and team UUID against the browser URL …/team/<team>/task/<id>.
  2. Re-run with -f json to see the raw response and the reason field.
  3. Verify the id length (often 16 characters) — re-copy it fully.
  4. Refresh auth (re-login / regenerate token) if the response suggests an auth problem.

Example fix

// before
opencli ones task 3fa2 --team T1        // truncated id
// after
opencli ones task 3fa2b1c9d8e7f601 --team T1
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof taskId !== 'string' || taskId.trim().length !== 16) throw new Error('Task uuid must be the full 16-char id from the task URL');

Type guard

function isTaskInfo(d) { return d != null && typeof d.uuid === 'string' && d.uuid.length > 0; }

Try / catch

try {
  const task = await opencli.ones.task(id, { team });
} catch (e) {
  if (e.code === 'FETCH_ERROR' && e.message.startsWith('ONES task info:')) {
    console.error('Task fetch failed; verify uuid+team match the browser URL.', e.message);
  } else throw e;
}

Prevention

When it happens

Trigger: The task id is wrong or truncated (ONES task uuids are often 16 chars), the id doesn't belong to the given team, the API returns an error/empty object, or auth is stale so the endpoint returns an error body.

Common situations: Copy-pasting a task id from a URL but missing characters; using a task id from team A with --team of team B; expired token returning an unexpected payload; API shape changes.

Related errors


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