jackwener/OpenCLI · error · CommandExecutionError
${label} returned HTTP ${resp.status} (${url})
Error message
${label} returned HTTP ${resp.status} (${url}) What it means
bbcFetchRss performs all HTTP fetches for the BBC news CLI against feeds.bbci.co.uk. When fetch succeeds but the response status is not ok (e.g. 404, 403, 5xx), the library throws this CommandExecutionError naming the feed label and the failing URL so the user knows exactly which BBC feed endpoint rejected the request.
Source
Thrown at clis/bbc/utils.js:68
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
- Verify the feed label/URL is a valid BBC RSS feed (test the URL in a browser or curl -I)
- Check network/proxy reachability to feeds.bbci.co.uk (VPN, firewall, proxy env vars)
- Retry later if the status is 5xx — often transient server-side
- Inspect the resp.status in the message to target the exact failing endpoint
Example fix
// before
const resp = await fetch(url);
// after
const resp = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' } });
if (!resp.ok) console.error(`feed unavailable: ${resp.status}`); Defensive patterns
Strategy: try-catch
Validate before calling
const head = await fetch(url, { method: 'HEAD' });
if (!head.ok) throw new Error(`BBC feed ${url} is unavailable (HTTP ${head.status})`); Type guard
function isOk(resp) { return resp != null && typeof resp.ok === 'boolean' && resp.ok; } Try / catch
try { await bbcFeed(label); } catch (e) { if (String(e.message).includes('returned HTTP')) { /* check URL/network, retry or skip */ } else throw e; } Prevention
- curl -I the feed URL before wiring it into scripts
- Handle 403/5xx with backoff retries
- Keep the feed label→URL map updated with valid BBC RSS endpoints
When it happens
Trigger: Calling any bbc CLI subcommand (via the xml path) whose feed URL returns a non-2xx HTTP status from feeds.bbci.co.uk, such as a renamed/removed feed slug or a feed temporarily returning 403/503.
Common situations: A mistyped or outdated feed label maps to a URL that now 404s; BBC edge/CDN returns 403 to datacenter or proxied networks; transient 5xx during BBC maintenance; corporate proxy blocking the domain.
Related errors
- 1point3acres request failed: HTTP ${res.status} ${res.status
- FETCH_ERROR
- HTTP ${result.httpStatus} from ${result.where}
- FETCH_ERROR
- 12306 queryByTrainNo returned HTTP ${resp.status}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/6d97c7dcdb79f4d7.
Report an issue: GitHub.