jackwener/OpenCLI · error · CommandExecutionError
dongchedi ${contextHint} network error: ${err?.message || er
Error message
dongchedi ${contextHint} network error: ${err?.message || err} What it means
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.
Source
Thrown at clis/dongchedi/utils.js:84
return real.length === 0;
}
/**
* Fetch a Dongchedi page and return its parsed `pageProps`.
* Throws typed errors so callers can let them propagate.
*/
export async function dcdFetchPageProps(path, contextHint) {
let resp;
try {
resp = await fetch(`${DCD_BASE}${path}`, {
headers: {
'User-Agent': UA,
Referer: `${DCD_BASE}/`,
'Accept-Language': 'zh-CN,zh;q=0.9',
},
});
} catch (err) {
throw new CommandExecutionError(
`dongchedi ${contextHint} network error: ${err?.message || err}`,
);
}
if (!resp.ok) {
throw new CommandExecutionError(`dongchedi ${contextHint} HTTP ${resp.status}`);
}
const html = await resp.text();
const pp = extractPageProps(html);
if (!pp) {
throw new CommandExecutionError(
`dongchedi ${contextHint} returned no __NEXT_DATA__`,
'Dongchedi likely changed its page structure, or the request hit an anti-bot page.',
);
}
if (isFallbackShell(pp)) {
throw new CommandExecutionError(
`dongchedi ${contextHint}`,
'Dongchedi served its empty fallback shell — the id may not exist or the URL form changed.',View on GitHub (pinned to 49907e53dc)
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.
Example fix
// before (no proxy in CI)
await dcdFetchPageProps('/auto/series/4983', 'specs 4983');
// after
process.env.HTTPS_PROXY = 'http://proxy.corp:8080'; // or set it in the CI env
await dcdFetchPageProps('/auto/series/4983', 'specs 4983'); Defensive patterns
Strategy: retry
Validate before calling
async function canReachDongchedi() {
try { const r = await fetch('https://www.dongchedi.com/', { method: 'HEAD' }); return r.ok || r.status < 500; }
catch { return false; }
} Try / catch
async function fetchWithRetry(path, hint, tries = 3) {
for (let i = 0; ; i++) {
try { return await dcdFetchPageProps(path, hint); }
catch (err) {
const transient = /network error/.test(err.message);
if (!transient || i >= tries - 1) throw err;
await new Promise((r) => setTimeout(r, 2 ** i * 1000));
}
}
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- coingecko derivatives request failed: ${err?.message ?? err}
- `${label} request failed: ${err?.message ?? err}`
- hf models request failed: ${error?.message || error}
- ${label} request failed: ${err?.message ?? err}. Check that
- ${label} request failed: ${err?.message ?? err}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/d9da5f9791adee0b.
Report an issue: GitHub.