jackwener/OpenCLI · error · CommandExecutionError

coingecko categories request failed: ${err?.message ?? err}

Error message

coingecko categories request failed: ${err?.message ?? err}

What it means

The fetch to https://api.coingecko.com/api/v3/coins/categories threw (network-level failure), and the CLI wraps it in a CommandExecutionError including the underlying error message. This happens before any HTTP status is available.

Source

Thrown at clis/coingecko/categories.js:44

            throw new ArgumentError(
                `coingecko sort "${args.sort}" is not supported`,
                `Supported sorts: ${ORDER_OPTIONS.join(', ')}`,
            );
        }
        const limit = Number(args.limit ?? 20);
        if (!Number.isInteger(limit) || limit <= 0) {
            throw new ArgumentError('coingecko limit must be a positive integer');
        }
        if (limit > 100) {
            throw new ArgumentError('coingecko limit must be <= 100');
        }
        const url = `https://api.coingecko.com/api/v3/coins/categories?order=${encodeURIComponent(sort)}`;
        let resp;
        try {
            resp = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' } });
        }
        catch (err) {
            throw new CommandExecutionError(`coingecko categories request failed: ${err?.message ?? err}`);
        }
        if (resp.status === 429) {
            throw new CommandExecutionError(
                'coingecko returned HTTP 429 (rate limited)',
                'Free tier allows ~30 calls/min. Wait and retry.',
            );
        }
        if (!resp.ok) {
            throw new CommandExecutionError(`coingecko categories returned HTTP ${resp.status}`);
        }
        let data;
        try {
            data = await resp.json();
        }
        catch (err) {
            throw new CommandExecutionError(`coingecko categories returned malformed JSON: ${err?.message ?? err}`);
        }
        if (!Array.isArray(data) || !data.length) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check network connectivity and retry the command
  2. Verify DNS/proxy settings (HTTPS_PROXY etc.) allow api.coingecko.com
  3. Retry later — the error message contains the underlying cause to diagnose further
Defensive patterns

Strategy: retry

Validate before calling

// preflight connectivity
try {
  await fetch('https://api.coingecko.com/api/v3/ping', { headers: { 'User-Agent': 'Mozilla/5.0' } });
} catch (e) {
  throw new Error('No network access to api.coingecko.com: ' + e.message);
}

Type guard

function isNetworkFailure(err) {
  return err instanceof CommandExecutionError && /fetch failed|ENOTFOUND|ECONNREFUSED|ETIMEDOUT|ECONNRESET/i.test(err.message);
}

Try / catch

try {
  await runCategories(args);
} catch (err) {
  if (isNetworkFailure(err)) {
    await sleep(2000);
    await runCategories(args); // retry once
  } else throw err;
}

Prevention

When it happens

Trigger: DNS failure, no network connection, TLS errors, connection refused/timeouts, or a proxy blocking api.coingecko.com from clis/coingecko/categories.js.

Common situations: Running the CLI behind a corporate proxy; offline or flaky network; firewall/VPN blocking CoinGecko; Node runtime without network access (sandboxed CI).

Related errors


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