{"record":{"id":"ebc9bc5ebf49ab32","repo":"jackwener/OpenCLI","slug":"sina-finance-rolling-news-api-returned-http-resp","errorCode":null,"errorMessage":"Sina Finance rolling news API returned HTTP ${response.status}","messagePattern":"Sina Finance rolling news API returned HTTP (.+?)","errorType":"http","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/sinafinance/rolling-news.js","lineNumber":79,"sourceCode":"    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":61,"sourceCodeEnd":91,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/sinafinance/rolling-news.js#L61-L91","documentation":"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.","triggerScenarios":"Sina returns 403 (rate limiting / Referer / anti-bot detection), 404 (endpoint moved), 5xx (upstream outage), or any non-ok status from the fetch response.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const rows = await cli.rollingNews();\n} catch (err) {\n  const m = err.message.match(/HTTP (\\d+)/);\n  if (m) {\n    const status = Number(m[1]);\n    if (status === 403) await sleep(60_000);        // throttled\n    else if (status >= 500) return retryLater();    // Sina outage\n    else throw err;                                  // 404 etc: do not retry\n  }\n  throw err;\n}","preventionTips":["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"],"tags":["http-status","api","rate-limit"],"backgroundTag":"http-4xx-5xx-response","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}