jackwener/OpenCLI · error · CommandExecutionError
Sina Finance rolling news API returned HTTP ${response.statu
Error message
Sina Finance rolling news API returned HTTP ${response.status} What it means
CommandExecutionError thrown when the rolling news endpoint responds with a non-2xx HTTP status. The status code is interpolated (e.g. 403, 404, 502). This separates transport failures (3515) from server-side rejections.
Source
Thrown at clis/sinafinance/rolling-news.js:79
args: [],
columns: ['column', 'title', 'date', 'url'],
func: async () => {
const params = new URLSearchParams({
pageid: '384',
lid: '2519',
k: '',
num: '50',
page: '1',
});
let response;
try {
response = await fetch(`${ROLL_API}?${params}`);
}
catch (error) {
throw new CommandExecutionError(`Sina Finance rolling news request failed: ${error instanceof Error ? error.message : String(error)}`);
}
if (!response.ok) {
throw new CommandExecutionError(`Sina Finance rolling news API returned HTTP ${response.status}`);
}
let payload;
try {
payload = await response.json();
}
catch (error) {
throw new CommandExecutionError(`Sina Finance rolling news API returned invalid JSON: ${error instanceof Error ? error.message : String(error)}`);
}
return normalizeRollRows(payload);
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Check the interpolated HTTP status: 403 = blocked/throttled, 404 = endpoint changed, 5xx = server-side issue
- For 403, reduce request frequency and add realistic headers/delays
- For 404, check whether Sina changed the API URL and update ROLL_API
- For 5xx, wait and retry later — it's a Sina-side outage
Defensive patterns
Strategy: retry
Try / catch
try {
const rows = await cli.rollingNews();
} catch (err) {
const m = err.message.match(/HTTP (\d+)/);
if (m) {
const status = Number(m[1]);
if (status === 403) await sleep(60_000); // throttled
else if (status >= 500) return retryLater(); // Sina outage
else throw err; // 404 etc: do not retry
}
throw err;
} Prevention
- Rate-limit your polling to avoid 403 blocks
- Watch for 404s signaling endpoint deprecation
- Back off on 5xx instead of hammering
- Include browser-like headers if bot detection triggers
When it happens
Trigger: Sina returns 403 (rate limiting / Referer / anti-bot detection), 404 (endpoint moved), 5xx (upstream outage), or any non-ok status from the fetch response.
Common situations: Heavy polling triggering Sina's rate limiter; Sina retiring or relocating the ROLL_API endpoint; Sina CDN returning 502/504 during incidents; missing headers causing bot detection 403s.
Related errors
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/ebc9bc5ebf49ab32.
Report an issue: GitHub.