{"record":{"id":"e2366c4bd6e679dc","repo":"jackwener/OpenCLI","slug":"sina-finance-rolling-news-request-failed-error","errorCode":null,"errorMessage":"Sina Finance rolling news request failed: ${error instanceof Error ? error.message : String(error)}","messagePattern":"Sina Finance rolling news request failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/sinafinance/rolling-news.js","lineNumber":76,"sourceCode":"    domain: 'feed.mix.sina.com.cn',\n    strategy: Strategy.PUBLIC,\n    browser: false,\n    args: [],\n    columns: ['column', 'title', 'date', 'url'],\n    func: async () => {\n        const params = new URLSearchParams({\n            pageid: '384',\n            lid: '2519',\n            k: '',\n            num: '50',\n            page: '1',\n        });\n        let response;\n        try {\n            response = await fetch(`${ROLL_API}?${params}`);\n        }\n        catch (error) {\n            throw new CommandExecutionError(`Sina Finance rolling news request failed: ${error instanceof Error ? error.message : String(error)}`);\n        }\n        if (!response.ok) {\n            throw new CommandExecutionError(`Sina Finance rolling news API returned HTTP ${response.status}`);\n        }\n        let payload;\n        try {\n            payload = await response.json();\n        }\n        catch (error) {\n            throw new CommandExecutionError(`Sina Finance rolling news API returned invalid JSON: ${error instanceof Error ? error.message : String(error)}`);\n        }\n        return normalizeRollRows(payload);\n    },\n});\n","sourceCodeStart":58,"sourceCodeEnd":91,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/sinafinance/rolling-news.js#L58-L91","documentation":"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.","triggerScenarios":"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.","commonSituations":"Running the CLI offline or behind a restrictive firewall; DNS misconfiguration; corporate proxies blocking finance.sina.com.cn; intermittent network drops in scheduled jobs.","solutions":["Check basic internet connectivity (ping/curl another site)","Verify DNS resolves the Sina API host (nslookup)","Check firewall/proxy rules allow the Sina finance domain","Retry with exponential backoff — transient network failures are common"],"exampleFix":"// before\ntry { await cli.rollingNews(); } catch (e) { throw e; }\n// after\ntry {\n    return await cli.rollingNews();\n} catch (e) {\n    if (String(e.message).includes('request failed')) return retryWithBackoff(cli.rollingNews);\n    throw e;\n}","handlingStrategy":"retry","validationCode":"// pre-flight connectivity check\nconst online = await fetch('https://finance.sina.com.cn', { method: 'HEAD' }).then(r => r.ok).catch(() => false);\nif (!online) throw new Error('No connectivity to sina.com.cn');","typeGuard":null,"tryCatchPattern":"try {\n  const rows = await cli.rollingNews();\n} catch (err) {\n  if (/request failed/.test(err.message)) {\n    // network-level failure (DNS/connect/timeout)\n    return retryWithBackoff(() => cli.rollingNews(), { retries: 3, baseMs: 1000 });\n  }\n  throw err;\n}","preventionTips":["Verify DNS and firewall allow finance.sina.com.cn","Add exponential backoff for transient network errors","Avoid running from networks that block Chinese finance domains","Set reasonable timeouts so hangs fail fast and retry"],"tags":["network","fetch","connection"],"backgroundTag":"connection-refused","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}