jackwener/OpenCLI · error · CommandExecutionError
${label} request failed: ${err?.message ?? err}
Error message
${label} request failed: ${err?.message ?? err} What it means
This CommandExecutionError wraps a network-level failure inside nugetFetch in clis/nuget/utils.js: the fetch() call to a NuGet endpoint rejected (DNS failure, connection refused, TLS error, offline) so no HTTP response exists. The message embeds the underlying error text and hints that api.nuget.org must be reachable. It is not an HTTP status error — the request never completed.
Source
Thrown at clis/nuget/utils.js:54
export function requirePackageId(value) {
const raw = String(value ?? '').trim();
if (!raw) throw new ArgumentError('nuget package id is required (e.g. "Newtonsoft.Json")');
if (!PACKAGE_ID_PATTERN.test(raw)) {
throw new ArgumentError(
`nuget package id "${value}" is not a valid NuGet identifier`,
'NuGet IDs are 1-100 chars: letters/digits/`.`/`_`/`-`, starting with letter or digit.',
);
}
return raw;
}
export async function nugetFetch(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 api.nuget.org is reachable from this network.',
);
}
if (resp.status === 404) {
throw new EmptyResultError(label, `NuGet 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
- Verify network connectivity: curl -I https://api.nuget.org/v3/index.json
- Check proxy configuration (HTTPS_PROXY/HTTP_PROXY) and that the proxy allows nuget.org
- Install/trust the corporate CA for Node (NODE_EXTRA_CA_CERTS) if TLS interception is in play
- Retry after transient network issues; the error is usually environmental, not a code bug
Defensive patterns
Strategy: retry
Validate before calling
// preflight reachability check
const ok = await fetch('https://api.nuget.org/v3/index.json', { method: 'HEAD' }).then(r => r.ok).catch(() => false);
if (!ok) throw new Error('nuget.org unreachable from this network'); Type guard
null
Try / catch
try {
const data = await nugetFetch(url, 'search');
} catch (e) {
if (e instanceof CommandExecutionError && e.message.includes('request failed')) {
await sleep(1000);
return nugetFetch(url, 'search'); // retry transient network failure
}
throw e;
} Prevention
- Check proxy env vars (HTTPS_PROXY) and NODE_EXTRA_CA_CERTS in corporate networks
- Add retry with exponential backoff for transient network errors
- Preflight connectivity in CI before running bulk nuget jobs
- Handle offline mode explicitly in scripts
When it happens
Trigger: Any nuget command (search/body/leaf paths that call nugetFetch) run while offline, behind a blocking firewall/proxy, with DNS failure for azuresearch-usnc.nuget.org or api.nuget.org, or with a TLS/certificate problem.
Common situations: Corporate proxies requiring custom CA certs not trusted by Node; VPN or captive-portal networks blocking the endpoint; CI runners without egress; typo'd proxy env vars breaking outbound fetch.
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}. Check that
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/61269eca28414204.
Report an issue: GitHub.