jackwener/OpenCLI · error · CommandExecutionError

Sina Finance rolling news request failed: ${error instanceof

Error message

Sina Finance rolling news request failed: ${error instanceof Error ? error.message : String(error)}

What it means

CommandExecutionError wrapping a network-level failure of the fetch() call for the rolling news endpoint. The original error message (DNS failure, connection refused, timeout, TLS error) is interpolated. This fires before any HTTP status check, meaning the request never got a response.

Source

Thrown at clis/sinafinance/rolling-news.js:76

    domain: 'feed.mix.sina.com.cn',
    strategy: Strategy.PUBLIC,
    browser: false,
    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

  1. Check basic internet connectivity (ping/curl another site)
  2. Verify DNS resolves the Sina API host (nslookup)
  3. Check firewall/proxy rules allow the Sina finance domain
  4. Retry with exponential backoff — transient network failures are common

Example fix

// before
try { await cli.rollingNews(); } catch (e) { throw e; }
// after
try {
    return await cli.rollingNews();
} catch (e) {
    if (String(e.message).includes('request failed')) return retryWithBackoff(cli.rollingNews);
    throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight connectivity check
const online = await fetch('https://finance.sina.com.cn', { method: 'HEAD' }).then(r => r.ok).catch(() => false);
if (!online) throw new Error('No connectivity to sina.com.cn');

Try / catch

try {
  const rows = await cli.rollingNews();
} catch (err) {
  if (/request failed/.test(err.message)) {
    // network-level failure (DNS/connect/timeout)
    return retryWithBackoff(() => cli.rollingNews(), { retries: 3, baseMs: 1000 });
  }
  throw err;
}

Prevention

When it happens

Trigger: fetch throws: DNS resolution failure for the Sina host, no network connectivity, connection refused/reset, TLS handshake failure, or request timeout — anything causing fetch to reject.

Common situations: Running the CLI offline or behind a restrictive firewall; DNS misconfiguration; corporate proxies blocking finance.sina.com.cn; intermittent network drops in scheduled jobs.

Related errors


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