{"record":{"id":"d9da5f9791adee0b","repo":"jackwener/OpenCLI","slug":"dongchedi-contexthint-network-error-err-mes","errorCode":null,"errorMessage":"dongchedi ${contextHint} network error: ${err?.message || err}","messagePattern":"dongchedi (.+?) network error: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/dongchedi/utils.js","lineNumber":84,"sourceCode":"    return real.length === 0;\n}\n\n/**\n * Fetch a Dongchedi page and return its parsed `pageProps`.\n * Throws typed errors so callers can let them propagate.\n */\nexport async function dcdFetchPageProps(path, contextHint) {\n    let resp;\n    try {\n        resp = await fetch(`${DCD_BASE}${path}`, {\n            headers: {\n                'User-Agent': UA,\n                Referer: `${DCD_BASE}/`,\n                'Accept-Language': 'zh-CN,zh;q=0.9',\n            },\n        });\n    } catch (err) {\n        throw new CommandExecutionError(\n            `dongchedi ${contextHint} network error: ${err?.message || err}`,\n        );\n    }\n    if (!resp.ok) {\n        throw new CommandExecutionError(`dongchedi ${contextHint} HTTP ${resp.status}`);\n    }\n    const html = await resp.text();\n    const pp = extractPageProps(html);\n    if (!pp) {\n        throw new CommandExecutionError(\n            `dongchedi ${contextHint} returned no __NEXT_DATA__`,\n            'Dongchedi likely changed its page structure, or the request hit an anti-bot page.',\n        );\n    }\n    if (isFallbackShell(pp)) {\n        throw new CommandExecutionError(\n            `dongchedi ${contextHint}`,\n            'Dongchedi served its empty fallback shell — the id may not exist or the URL form changed.',","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/dongchedi/utils.js#L66-L102","documentation":"A CommandExecutionError raised in dcdFetchPageProps (clis/dongchedi/utils.js:84) when the initial `fetch()` to www.dongchedi.com itself rejects — the request never got an HTTP response. The original error (DNS failure, connection reset, TLS problem, timeout) is wrapped with a `dongchedi <context> network error:` prefix identifying which command's fetch failed.","triggerScenarios":"Any dongchedi command (search, specs, models, score, koubei, series) when the machine has no internet, DNS cannot resolve www.dongchedi.com, a proxy/firewall blocks the connection, TLS interception fails, or the Node runtime lacks a global fetch (Node < 18).","commonSituations":"Running the CLI in an offline CI container or corporate network requiring a proxy; VPN or GFW-related blocks on the ByteDance-hosted site; Docker images without CA certificates; older Node versions without native fetch.","solutions":["Verify basic connectivity: `curl -I https://www.dongchedi.com` from the same machine.","If behind a proxy, set HTTPS_PROXY/HTTP_PROXY environment variables (and ensure fetch honors them via undici's ProxyAgent or NODE_USE_ENV_PROXY).","Check DNS resolution of www.dongchedi.com (`nslookup www.dongchedi.com`).","Upgrade to Node >= 18 so global fetch exists, and ensure the system CA bundle is present for TLS.","Catch CommandExecutionError, read the wrapped message, and retry with backoff for transient network faults."],"exampleFix":"// before (no proxy in CI)\nawait dcdFetchPageProps('/auto/series/4983', 'specs 4983');\n// after\nprocess.env.HTTPS_PROXY = 'http://proxy.corp:8080'; // or set it in the CI env\nawait dcdFetchPageProps('/auto/series/4983', 'specs 4983');","handlingStrategy":"retry","validationCode":"async function canReachDongchedi() {\n  try { const r = await fetch('https://www.dongchedi.com/', { method: 'HEAD' }); return r.ok || r.status < 500; }\n  catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"async function fetchWithRetry(path, hint, tries = 3) {\n  for (let i = 0; ; i++) {\n    try { return await dcdFetchPageProps(path, hint); }\n    catch (err) {\n      const transient = /network error/.test(err.message);\n      if (!transient || i >= tries - 1) throw err;\n      await new Promise((r) => setTimeout(r, 2 ** i * 1000));\n    }\n  }\n}","preventionTips":["Run on Node >= 18 so global fetch exists.","Set HTTPS_PROXY/HTTP_PROXY when running behind corporate proxies or in CI.","Ensure DNS and the CA bundle work for www.dongchedi.com from the deployment environment.","Retry transient network errors with exponential backoff."],"tags":["network","fetch","dongchedi","connectivity"],"backgroundTag":"network-request-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}