jackwener/OpenCLI · error · CliError

FETCH_ERROR

FETCH_ERROR

Error message

ONES worklog: all endpoints failed (last: ${lastDetail})

What it means

This FETCH_ERROR is thrown by the ONES worklog command after it tried every candidate worklog API endpoint and each failed; the message includes the last failure detail. It aggregates multiple endpoint attempts into one terminal error because ONES worklog APIs vary across deployments/versions.

Source

Thrown at clis/ones/worklog.js:266

                        ];
                    }
                    lastDetail = `no effect (total_manhour ${String(beforeTotal)} -> ${String(afterTotal)})`;
                    continue;
                }
                // If verification read fails, return success conservatively.
                return [
                    {
                        task: taskId,
                        date: dateStr,
                        hours: String(hoursHuman),
                        owner: ownerId,
                        endpoint: path,
                    },
                ];
            }
            lastDetail = fail;
        }
        throw new CliError('FETCH_ERROR', `ONES worklog: all endpoints failed (last: ${lastDetail})`);
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the `last:` detail in the message to see the underlying failure (401 → re-auth; 403 → permissions).
  2. Re-authenticate / refresh the ONES token, then retry.
  3. Verify the owner and task uuids are valid and the account can log work in the ONES web UI.
  4. Check ONES_* env vars (host/org) point to the correct instance; if it persists, report the ONES server version since endpoint shapes vary.

Example fix

// before
opencli ones worklog <taskUUID> 2 --team T1   // 401 from stale cookie
// after
opencli ones login && opencli ones worklog <taskUUID> 2 --team T1
Defensive patterns

Strategy: retry

Validate before calling

const probe = await onesFetchInPage(page, 'auth/token_info');
if (!probe?.user?.uuid) throw new Error('Session invalid — re-authenticate before logging work.');

Type guard

function isRetryableWorklogFailure(e) { return e.code === 'FETCH_ERROR' && /all endpoints failed/.test(e.message); }

Try / catch

try {
  await opencli.ones.worklog({ task, hours, team });
} catch (e) {
  if (e.code === 'FETCH_ERROR' && /all endpoints failed/.test(e.message)) {
    console.error(e.message); // inspect `last:` detail
    await refreshAuth();
    return retryWithBackoff(() => opencli.ones.worklog({ task, hours, team }), 2);
  }
  throw e;
}

Prevention

When it happens

Trigger: All worklog endpoints return errors — e.g. invalid owner/task uuid, insufficient permissions to write worklogs, expired auth, or the ONES instance exposes none of the supported endpoint shapes.

Common situations: Restricted accounts that lack worklog write permission; wrong org/host configuration; ONES server version whose worklog API differs; stale session cookies.

Related errors


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