{"record":{"id":"e567210289265d4a","repo":"jackwener/OpenCLI","slug":"fetch-error-e56721","errorCode":"FETCH_ERROR","errorMessage":"FETCH_ERROR","messagePattern":"FETCH_ERROR","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/yollomi/utils.js","lineNumber":49,"sourceCode":"    await ensureOnYollomi(page);\n    const result = await page.evaluate(`\n    (async () => {\n      try {\n        const res = await fetch(${JSON.stringify(apiPath)}, {\n          method: 'POST',\n          headers: { 'Content-Type': 'application/json' },\n          credentials: 'include',\n          body: ${JSON.stringify(bodyJson)},\n        });\n        const text = await res.text();\n        return { ok: res.ok, status: res.status, body: text };\n      } catch (err) {\n        return { ok: false, status: 0, body: err.message || 'fetch failed (on ' + location.href + ')' };\n      }\n    })()\n  `);\n    if (!result || result.status === 0) {\n        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');\n    }\n    if (!result.ok) {\n        let detail = result.body;\n        try {\n            detail = JSON.parse(result.body)?.error || JSON.parse(result.body)?.message || result.body;\n        }\n        catch { }\n        throw new CliError('API_ERROR', `Yollomi API ${result.status}: ${detail}`, result.status === 401\n            ? 'Not logged in — open Chrome, go to https://yollomi.com and log in'\n            : result.status === 402\n                ? 'Insufficient credits — top up at https://yollomi.com/pricing'\n                : result.status === 429\n                    ? 'Rate limited — wait a moment and retry'\n                    : 'Check the model and parameters');\n    }\n    try {\n        return JSON.parse(result.body);\n    }","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/yollomi/utils.js#L31-L67","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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)","Log in to https://yollomi.com in that Chrome window","Check basic connectivity from that machine/browser (try loading the site manually)","Retry once connectivity is restored; the failure is at network level, not parameter level"],"exampleFix":"// before\nyollomi generate --prompt \"a cat\"   # Chrome closed\n// FETCH_ERROR: Network error: Failed to fetch\n// after\n# launch Chrome, open https://yollomi.com, log in, keep Browser Bridge running\nyollomi generate --prompt \"a cat\"","handlingStrategy":"retry","validationCode":"// Before running commands, verify the bridge target is alive:\n// ensure Chrome is open on a https://yollomi.com page and the site loads\nawait fetch('https://yollomi.com').catch(() => { throw new Error('yollomi.com unreachable'); });","typeGuard":"null","tryCatchPattern":"try {\n  await yollomiPost(page, endpoint, body);\n} catch (e) {\n  if (e.code === 'FETCH_ERROR') {\n    // check Chrome + Browser Bridge + login, then retry with backoff\n    await sleep(2000);\n    return yollomiPost(page, endpoint, body);\n  }\n  throw e;\n}","preventionTips":["Always launch Chrome and open yollomi.com before running commands","Monitor the Browser Bridge process in automation scripts","Add retry-with-backoff wrappers around yollomiPost calls","Check machine connectivity/proxies when errors persist"],"tags":["network","browser-bridge","cli","fetch"],"backgroundTag":"fetch-failed-network-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}