jackwener/OpenCLI · error · CommandExecutionError

${label} request failed: ${err?.message ?? err}

Error message

${label} request failed: ${err?.message ?? err}

What it means

oeisFetch wraps its fetch() call; if the request to oeis.org throws at the network level (DNS failure, connection refused, TLS error, timeout), it rethrows as a CommandExecutionError with the underlying message and a hint to check network reachability. This distinguishes connectivity problems from HTTP status errors handled later.

Source

Thrown at clis/oeis/utils.js:52

    if (!raw) throw new ArgumentError('oeis sequence id is required (e.g. "A000045" for Fibonacci)');
    // Tolerate common URL paste like `https://oeis.org/A000045`.
    const stripped = raw.replace(/^HTTPS?:\/\/(?:WWW\.)?OEIS\.ORG\//, '').replace(/\/.*$/, '');
    if (!SEQUENCE_ID_PATTERN.test(stripped)) {
        throw new ArgumentError(
            `oeis sequence id "${value}" is not a valid A-number`,
            'Expected format: "A" + digits (e.g. "A000045").',
        );
    }
    return stripped;
}

export async function oeisFetch(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 oeis.org is reachable from this network.',
        );
    }
    if (resp.status === 404) {
        throw new EmptyResultError(label, `OEIS returned 404 for ${url}.`);
    }
    if (resp.status === 429) {
        throw new CommandExecutionError(`${label} returned HTTP 429 (rate limited)`);
    }
    if (!resp.ok) {
        throw new CommandExecutionError(`${label} returned HTTP ${resp.status}`);
    }
    let body;
    try {
        body = await resp.json();
    }
    catch (err) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify network connectivity, e.g. `curl -I https://oeis.org`.
  2. Check proxy settings (HTTPS_PROXY/HTTP_PROXY) if behind a corporate network.
  3. Retry after confirming oeis.org status; the message contains the underlying cause.

Example fix

// before (offline)
oeis search fibonacci
// after
export HTTPS_PROXY=http://proxy.corp:8080
oeis search fibonacci
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight reachability check
const res = await fetch('https://oeis.org', { method: 'HEAD' }).catch(() => null);
if (!res) throw new Error('oeis.org is unreachable from this network');

Type guard

null

Try / catch

try { const data = await oeisFetch(url, label); } catch (e) { if (String(e.message).includes('request failed')) console.error('Network problem, check connectivity/proxy:', e.message); else throw e; }

Prevention

When it happens

Trigger: Any OEIS request when oeis.org is unreachable: no internet connection, DNS resolution failure, firewall/proxy blocking, or a TLS handshake failure.

Common situations: Working offline, corporate proxy without proper env vars (HTTPS_PROXY), DNS misconfiguration, or transient oeis.org outage.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/d489edcd72f60bfa. Report an issue: GitHub.