jackwener/OpenCLI · error · CommandExecutionError
${label} request failed: ${err?.message ?? err}. Check that
Error message
${label} request failed: ${err?.message ?? err}. Check that lichess.org is reachable from this network. What it means
This CommandExecutionError wraps a network-level failure of the HTTP request to lichess.org inside `lichessFetch`. The `fetch` call itself threw (DNS failure, connection refused, TLS error, timeout), so the library rethrows with the label and a reachability hint.
Source
Thrown at clis/lichess/utils.js:64
export function requireBoundedInt(value, defaultValue, maxValue, label = 'limit') {
const raw = value ?? defaultValue;
const n = typeof raw === 'number' ? raw : Number(raw);
if (!Number.isInteger(n) || n <= 0) {
throw new ArgumentError(`lichess ${label} must be a positive integer`);
}
if (n > maxValue) {
throw new ArgumentError(`lichess ${label} must be <= ${maxValue}`);
}
return n;
}
export async function lichessFetch(url, label) {
let resp;
try {
resp = await fetch(url, { headers: { 'user-agent': UA, accept: 'application/json' } });
}
catch (err) {
throw new CommandExecutionError(
`${label} request failed: ${err?.message ?? err}`,
'Check that lichess.org is reachable from this network.',
);
}
if (resp.status === 404) {
throw new EmptyResultError(label, `Lichess returned 404 for ${url}.`);
}
if (resp.status === 429) {
throw new CommandExecutionError(
`${label} returned HTTP 429 (rate limited)`,
'Lichess throttles anonymous traffic at ~60 req/min; back off and retry.',
);
}
if (!resp.ok) {
throw new CommandExecutionError(`${label} returned HTTP ${resp.status}`);
}
let body;
try {View on GitHub (pinned to 49907e53dc)
Solutions
- Check general connectivity, then `curl -I https://lichess.org/api` to test reachability
- Read the underlying `err.message` in the error text to identify DNS vs connection vs TLS issues
- Configure proxy/HTTPS_PROXY environment variables if behind a corporate proxy
- Retry with backoff if it was a transient network blip
- Fix DNS settings or switch networks if resolution is failing
Example fix
// before
await lichessFetch(url, label); // throws on any network hiccup
// after
import pRetry from 'p-retry';
const resp = await pRetry(() => lichessFetch(url, label), { retries: 3, minTimeout: 500 }); Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight reachability check before batch runs
async function lichessReachable() {
try { const r = await fetch('https://lichess.org/api'); return r.ok || r.status < 500; }
catch { return false; }
}
if (!(await lichessReachable())) throw new Error('lichess.org unreachable — check network/proxy'); Try / catch
import pRetry from 'p-retry';
try {
const data = await pRetry(() => body(url, label), {
retries: 3,
onFailedAttempt: e => console.warn(`attempt ${e.attemptNumber} failed: ${e.message}`),
});
} catch (e) {
console.error(`Cannot reach lichess.org: ${e.message}. Check network, DNS, and HTTPS_PROXY.`);
process.exitCode = 1;
} Prevention
- Verify connectivity/DNS (curl https://lichess.org/api) before batch jobs
- Set HTTPS_PROXY/HTTP_PROXY correctly on corporate networks
- Add retry-with-backoff for transient network failures
- Fail fast with a pre-flight check in scripts and CI
When it happens
Trigger: Any command routed through `lichessFetch` when `fetch(url)` rejects: no network connection, DNS resolution failure, firewall/proxy blocking lichess.org, TLS interception, or a request timeout.
Common situations: Working offline or on a captive-portal Wi-Fi; corporate proxy blocking the domain; DNS misconfiguration; VPN dropping; transient ISP outage; IPv6 issues reaching lichess.org.
Related errors
- coingecko derivatives request failed: ${err?.message ?? err}
- dongchedi ${contextHint} network error: ${err?.message || er
- `${label} request failed: ${err?.message ?? err}`
- hf models request failed: ${error?.message || error}
- ${label} request failed: ${err?.message ?? err}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/54474a1ee46e7fbb.
Report an issue: GitHub.