jackwener/OpenCLI · error · CommandExecutionError

${label} request failed: ${err?.message ?? err}

Error message

${label} request failed: ${err?.message ?? err}

What it means

CommandExecutionError from `bbcFetchRss` when the `fetch` call to feeds.bbci.co.uk throws (DNS failure, connection refused, TLS error, timeout) — i.e. the request never got an HTTP response. The label (e.g. 'bbc topic technology') plus the underlying err message are embedded to identify which feed failed and why.

Source

Thrown at clis/bbc/utils.js:62

    const raw = value ?? defaultValue;
    const n = typeof raw === 'number' ? raw : Number(raw);
    if (!Number.isInteger(n) || n <= 0) {
        throw new ArgumentError(`bbc ${label} must be a positive integer`);
    }
    if (n > maxValue) {
        throw new ArgumentError(`bbc ${label} must be <= ${maxValue}`);
    }
    return n;
}

export async function bbcFetchRss(path, label) {
    const url = `${BBC_FEED_BASE}/${path}`;
    let resp;
    try {
        resp = await fetch(url, { headers: { 'user-agent': UA, accept: 'application/rss+xml, application/xml' } });
    }
    catch (err) {
        throw new CommandExecutionError(
            `${label} request failed: ${err?.message ?? err}`,
            'Check that feeds.bbci.co.uk is reachable from this network.',
        );
    }
    if (!resp.ok) {
        throw new CommandExecutionError(`${label} returned HTTP ${resp.status} (${url})`);
    }
    return resp.text();
}

/** Convert RFC-822 pubDate to ISO `YYYY-MM-DD`; empty string on parse failure. */
export function pubDateToIso(value) {
    if (!value) return '';
    const d = new Date(value);
    if (Number.isNaN(d.getTime())) return '';
    return d.toISOString().slice(0, 10);
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the underlying `err.message` in the thrown error to identify the transport cause (ENOTFOUND, ECONNREFUSED, cert error, etc.).
  2. Verify general internet connectivity and that https://feeds.bbci.co.uk loads in a browser/curl.
  3. Fix DNS/proxy/VPN settings or allowlist feeds.bbci.co.uk on the network.
  4. If in Node with custom TLS inspection, set NODE_EXTRA_CA_CERTS to the corporate CA bundle.
  5. Add retry logic for transient network failures.

Example fix

// before
const xml = await bbcFetchRss(`${raw}/rss.xml`, `bbc topic ${raw}`);
// after
try {
  const xml = await bbcFetchRss(`${raw}/rss.xml`, `bbc topic ${raw}`);
} catch (e) {
  if (/ENOTFOUND|ECONNREFUSED|ETIMEDOUT/.test(e.message)) {
    console.error('Network unreachable; check connectivity to feeds.bbci.co.uk');
  }
  throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

const reachable = await fetch('https://feeds.bbci.co.uk/news/rss.xml', { method: 'HEAD' }).then(r => r.ok).catch(() => false);
if (!reachable) throw new Error('feeds.bbci.co.uk unreachable — check network/DNS/proxy');

Type guard

const isNetworkError = (e) => /ENOTFOUND|ECONNREFUSED|ECONNRESET|ETIMEDOUT|CERT|fetch failed/i.test(String(e?.cause?.code || e?.message));

Try / catch

try {
  const xml = await bbcFetchRss(path, label);
} catch (e) {
  if (isNetworkError(e)) {
    await new Promise(r => setTimeout(r, 2000));
    // retry up to 3 times, then surface connectivity guidance
  } else throw e;
}

Prevention

When it happens

Trigger: Any `bbc topic` call where the network request to `https://feeds.bbci.co.uk/<path>` fails at the transport layer: no internet, DNS resolution failure, corporate firewall blocking the domain, IPv6 issues, or fetch timeout.

Common situations: Offline development machines, VPN/proxy configurations that block feeds.bbci.co.uk, DNS misconfiguration, container/CI environments without network egress, TLS interception certificates not trusted by Node.

Related errors


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