jackwener/OpenCLI · error · CommandExecutionError
${label} request failed: ${err?.message ?? err}
Error message
${label} request failed: ${err?.message ?? err} What it means
mavenFetch() wraps its fetch() call; if the network request itself throws (DNS failure, connection refused/reset, TLS error, offline), the error is rethrown as a CommandExecutionError with the label and the underlying message, advising that search.maven.org must be reachable.
Source
Thrown at clis/maven/utils.js:77
if (artifactId.length > 200 || !COORD_TOKEN.test(artifactId)) {
throw new ArgumentError(
`maven artifactId "${artifactId}" is not a valid token`,
'Use letters / digits / "_-." (max 200 chars), starting with a letter or digit.',
);
}
if (version != null && version.length > 200) {
throw new ArgumentError(`maven version "${version}" is too long (max 200 chars).`);
}
return { groupId, artifactId, version: version ?? null };
}
export async function mavenFetch(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 search.maven.org is reachable from this network.',
);
}
if (resp.status === 404) {
throw new EmptyResultError(label, `Maven Central returned 404 for ${url}.`);
}
if (resp.status === 429) {
throw new CommandExecutionError(
`${label} returned HTTP 429 (rate limited)`,
'Maven Central throttles bursts; wait a few seconds and retry.',
);
}
if (!resp.ok) {
throw new CommandExecutionError(`${label} returned HTTP ${resp.status}`);
}
let body;
try {View on GitHub (pinned to 49907e53dc)
Solutions
- Verify network connectivity (e.g. curl https://search.maven.org/solrsearch/select?q=guava).
- Check DNS resolution for search.maven.org.
- Configure proxy environment variables (HTTPS_PROXY) if behind a corporate proxy.
- Retry after a moment if it was a transient network error; add retry with backoff around the call.
Example fix
// before
const data = await mavenFetch(url, 'search');
// after
try {
const data = await mavenFetch(url, 'search');
} catch (err) {
if (/request failed/.test(String(err))) await sleep(1000); // retry transient network
throw err;
} Defensive patterns
Strategy: retry
Validate before calling
const reachable = await fetch('https://search.maven.org/solrsearch/select?q=a:guava&rows=1')
.then(() => true).catch(() => false);
if (!reachable) throw new Error('search.maven.org is not reachable'); Type guard
null
Try / catch
try {
return await mavenFetch(url, 'search');
} catch (err) {
if (/request failed/.test(String(err.message))) {
await sleep(backoff(attempt)); // retry transient network errors
return mavenFetch(url, 'search');
}
throw err;
} Prevention
- Check egress/firewall rules allow HTTPS to search.maven.org, especially in CI.
- Set HTTPS_PROXY correctly in corporate environments.
- Monitor DNS in containers/VPNs.
- Wrap network calls in retry-with-backoff from the start.
When it happens
Trigger: Any maven lookup while the network cannot reach search.maven.org: no internet, DNS outage, corporate proxy/firewall blocking the host, TLS interception, or Node fetch failing to resolve the hostname.
Common situations: Running in CI sandboxes without egress; VPN or proxy misconfiguration; DNS misconfigured in containers; the host being blocked by a corporate allowlist; transient network flap.
Related errors
- ${label} request failed: ${err?.message ?? err}
- FETCH_ERROR
- archive search request failed: ${error?.message || error}
- archive wayback 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/8e686465f9ae2bb7.
Report an issue: GitHub.