jackwener/OpenCLI · error · CommandExecutionError

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

Error message

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

What it means

rawFetch wraps the underlying fetch() failure in a CommandExecutionError at clis/goproxy/utils.js:66. This means the HTTP request to proxy.golang.org never completed — a network-level failure (DNS, TCP, TLS, proxy) rather than an HTTP error status, with the original error message appended.

Source

Thrown at clis/goproxy/utils.js:66

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(`goproxy ${label} must be a positive integer`);
    }
    if (n > maxValue) {
        throw new ArgumentError(`goproxy ${label} must be <= ${maxValue}`);
    }
    return n;
}

async function rawFetch(url, label) {
    let resp;
    try {
        resp = await fetch(url, { headers: { 'user-agent': UA } });
    }
    catch (err) {
        throw new CommandExecutionError(
            `${label} request failed: ${err?.message ?? err}`,
            'Check that proxy.golang.org is reachable from this network.',
        );
    }
    if (resp.status === 404 || resp.status === 410) {
        throw new EmptyResultError(label, `proxy.golang.org returned ${resp.status} 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}`);
    }
    return resp;
}

export async function goproxyJson(url, label) {
    const resp = await rawFetch(url, label);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify network reachability: `curl -I https://proxy.golang.org` from the same machine.
  2. Check DNS (`nslookup proxy.golang.org`) and any HTTP(S)_PROXY environment variables; set them for the CLI if your network requires a proxy.
  3. Restore internet/VPN access or run from a network that allows proxy.golang.org.
  4. If running old Node (<18), upgrade so global fetch exists, or polyfill undici.

Example fix

// before (CI, no egress)
const versions = await goproxyVersions(mod);
// after — configure proxy / verify connectivity first
await dns.promises.resolve('proxy.golang.org');
const versions = await goproxyVersions(mod);
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight connectivity check
try {
  await fetch('https://proxy.golang.org', { method: 'HEAD' });
} catch {
  throw new Error('proxy.golang.org unreachable — check network/proxy settings');
}

Type guard

null

Try / catch

try {
  const data = await goproxyJson(url, label);
} catch (err) {
  if (err instanceof CommandExecutionError && /request failed/.test(err.message)) {
    // network-level failure: retry with backoff or surface connectivity guidance
    await new Promise(r => setTimeout(r, 2000));
    return goproxyJson(url, label);
  }
  throw err;
}

Prevention

When it happens

Trigger: fetch() rejects: DNS resolution failure for proxy.golang.org, no internet/VPN down, corporate firewall blocking, TLS interception with an untrusted cert, or Node < 18 without global fetch bound in the runtime.

Common situations: Working offline; CI runners without network egress; restrictive corporate proxies; IPv6/DNS misconfiguration; NODE_OPTIONS/runtime where fetch is undefined so calling it throws TypeError captured here.

Related errors


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