google-gemini/gemini-cli · error · FetchError
getErrorMessage(error)
Error message
getErrorMessage(error)
What it means
Generic wrapper around a getErrorMessage(error) call: this branch surfaces the underlying cause of a failed fetch (network error, DNS failure, TLS error, etc.) rather than a timeout or user abort, which are handled by the preceding guards. The message text is whatever the original error carried.
Solutions
- Read the wrapped message to identify the real network failure
- Verify URL, DNS, proxy, and TLS configuration for the target host
- Retry transient network failures via the retry layer
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at packages/core/src/utils/fetch.ts:501 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of google-gemini/gemini-cli@6a466a7e2f (2026-09-16).
Data as JSON: /api/errors/ac3c2366ad47cc34.
Report an issue: GitHub.
Appendix: source
Thrown at packages/core/src/utils/fetch.ts:501
// If the caller's own signal was already aborted, this is a user-initiated
// cancellation (e.g. Ctrl+C), not an internal timeout. Re-throw as a plain
// AbortError so the retry layer does NOT treat it as a retryable ETIMEDOUT.
if (options?.signal?.aborted) {
// Rethrow the original abort reason or the caught error to preserve
// the stack trace and any custom abort reason (e.g. from Ctrl+C).
throw options.signal.reason ?? error;
}
throw new FetchError(`Request timed out after ${timeout}ms`, 'ETIMEDOUT');
}
if (error instanceof PrivateIpError) {
throw error;
}
if (error && typeof error === 'object' && 'cause' in error) {
if (error.cause instanceof PrivateIpError) {
throw error.cause;
}
}
throw new FetchError(getErrorMessage(error), undefined, { cause: error });
} finally {
clearTimeout(timeoutId);
}
}
export function setGlobalProxy(proxy: string) {
const trimmedProxy = proxy.trim();
currentProxy = trimmedProxy;
const noProxy = (
process.env['NO_PROXY'] ??
process.env['no_proxy'] ??
''
)?.trim();
undici.setGlobalDispatcher(
new undici.EnvHttpProxyAgent({
httpProxy: trimmedProxy,
httpsProxy: trimmedProxy,
noProxy,View on GitHub (pinned to 6a466a7e2f)