jackwener/OpenCLI · error · CliError

FETCH_ERROR

FETCH_ERROR

Error message

FETCH_ERROR

What it means

FETCH_ERROR is thrown by yollomiPost when the browser-side fetch fails at the network level: the in-page fetch threw (status 0) or evaluate returned nothing. This is a transport failure — the HTTP request never completed — distinct from API_ERROR which means the server answered.

Source

Thrown at clis/yollomi/utils.js:49

    await ensureOnYollomi(page);
    const result = await page.evaluate(`
    (async () => {
      try {
        const res = await fetch(${JSON.stringify(apiPath)}, {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          credentials: 'include',
          body: ${JSON.stringify(bodyJson)},
        });
        const text = await res.text();
        return { ok: res.ok, status: res.status, body: text };
      } catch (err) {
        return { ok: false, status: 0, body: err.message || 'fetch failed (on ' + location.href + ')' };
      }
    })()
  `);
    if (!result || result.status === 0) {
        throw new CliError('FETCH_ERROR', `Network error: ${result?.body || 'Failed to fetch'}`, 'Make sure Chrome is logged in to https://yollomi.com and the Browser Bridge is running');
    }
    if (!result.ok) {
        let detail = result.body;
        try {
            detail = JSON.parse(result.body)?.error || JSON.parse(result.body)?.message || result.body;
        }
        catch { }
        throw new CliError('API_ERROR', `Yollomi API ${result.status}: ${detail}`, result.status === 401
            ? 'Not logged in — open Chrome, go to https://yollomi.com and log in'
            : result.status === 402
                ? 'Insufficient credits — top up at https://yollomi.com/pricing'
                : result.status === 429
                    ? 'Rate limited — wait a moment and retry'
                    : 'Check the model and parameters');
    }
    try {
        return JSON.parse(result.body);
    }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Start Chrome with the Browser Bridge running and make sure it is on a yollomi.com page (the error mentions the location.href it failed on)
  2. Log in to https://yollomi.com in that Chrome window
  3. Check basic connectivity from that machine/browser (try loading the site manually)
  4. Retry once connectivity is restored; the failure is at network level, not parameter level

Example fix

// before
yollomi generate --prompt "a cat"   # Chrome closed
// FETCH_ERROR: Network error: Failed to fetch
// after
# launch Chrome, open https://yollomi.com, log in, keep Browser Bridge running
yollomi generate --prompt "a cat"
Defensive patterns

Strategy: retry

Validate before calling

// Before running commands, verify the bridge target is alive:
// ensure Chrome is open on a https://yollomi.com page and the site loads
await fetch('https://yollomi.com').catch(() => { throw new Error('yollomi.com unreachable'); });

Type guard

null

Try / catch

try {
  await yollomiPost(page, endpoint, body);
} catch (e) {
  if (e.code === 'FETCH_ERROR') {
    // check Chrome + Browser Bridge + login, then retry with backoff
    await sleep(2000);
    return yollomiPost(page, endpoint, body);
  }
  throw e;
}

Prevention

When it happens

Trigger: result is null/undefined (evaluate failed) or result.status === 0, meaning the in-page fetch threw; err.message or the fallback 'fetch failed (on ...)' is surfaced. Any yollomi command that posts to the API via the Browser Bridge can produce it.

Common situations: Chrome closed or the Browser Bridge not running, not logged in / redirected off yollomi.com so location.href is wrong, DNS or TLS failures, offline machine, or site being down.

Related errors


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