neoclide/coc.nvim · error
Request failed using proxy ${proxy.host}: ${err.message}
Error message
Request failed using proxy ${proxy.host}: ${err.message} What it means
fetch() wraps any request failure: if the request used a proxy agent (opts.agent.proxy set), the original error is replaced with 'Request failed using proxy <proxy.host>: <original message>' after logging the underlying error. This contextualizes network failures as proxy-related, since a misconfigured or unreachable proxy is the likely cause when a proxy agent is active.
Source
Thrown at src/model/fetch.ts:330
/**
* Send request to server for response, supports:
*
* - Send json data and parse json response.
* - Throw error for failed response statusCode.
* - Timeout support (no timeout by default).
* - Send buffer (as data) and receive data (as response).
* - Proxy support from user configuration & environment.
* - Redirect support, limited to 3.
* - Support of gzip & deflate response content.
*/
export default function fetch(urlInput: string | URL, options: FetchOptions = {}, token?: CancellationToken): Promise<ResponseResult> {
let url = toURL(urlInput)
let opts = resolveRequestOptions(url, options)
return request(url, options.data, opts, token).catch(err => {
logger.error(`Fetch error for ${url}:`, opts, err)
if (opts.agent && opts.agent.proxy) {
let { proxy } = opts.agent
throw new Error(`Request failed using proxy ${proxy.host}: ${err.message}`)
} else {
throw err
}
})
}
View on GitHub (pinned to 50e974d969)
Solutions
- Check the underlying err.message after the colon — it names the real cause (ECONNREFUSED, ETIMEDOUT, 407, certificate error).
- Verify the proxy host/port in configuration (e.g. http.proxy) and that the proxy is reachable: curl -x http://host:port https://example.com.
- If no proxy is needed, clear the proxy setting so the request goes direct and surfaces the raw error.
- For HTTPS through the proxy, configure proxyCA (options.proxyCA) if the proxy re-signs TLS.
- Retry after network/proxy recovery; transient proxy outages are common.
Example fix
// before (config)
{ "http.proxy": "http://127.0.0.1:8080" } // proxy down
// after
{ "http.proxy": "" } // or point at the correct proxy
// then retry the fetch Defensive patterns
Strategy: retry
Validate before calling
const net = require('net')
async function proxyReachable(host, port) {
return new Promise(res => {
const s = net.connect({ host, port, timeout: 3000 }, () => { s.destroy(); res(true) })
s.on('error', () => res(false)); s.on('timeout', () => { s.destroy(); res(false) })
})
}
// only call fetch if await proxyReachable(proxyHost, proxyPort) Try / catch
try {
return await fetch(url)
} catch (e) {
const m = /^Request failed using proxy (.+?): (.*)$/.exec(e.message)
if (m) {
logger.warn(`proxy ${m[1]} failed: ${m[2]}; retrying without proxy`)
return fetchWithoutProxy(url)
}
throw e
} Prevention
- Probe proxy reachability (TCP connect) before relying on it for long-running operations.
- Configure proxy authentication and proxyCA when the proxy requires them.
- Parse the underlying cause after 'Request failed using proxy <host>:' to distinguish ECONNREFUSED / 407 / TLS errors.
- Implement a fallback path (direct connection or secondary proxy) for resilience.
When it happens
Trigger: A request through coc's configured HTTP proxy fails — proxy host unreachable, proxy rejects CONNECT, wrong credentials, proxy timeout, or TLS failure against the proxy — producing e.g. 'Request failed using proxy 127.0.0.1:8080: connect ECONNREFUSED 127.0.0.1:8080'.
Common situations: Corporate proxies requiring authentication not configured in coc settings; VPN toggled off so the proxy address is unreachable; httpProxy pointing at a dead port; proxy CA not trusted (proxyCA not set).
Related errors
- Unsupported charset: ${encoding}
- Not valid protocol with ${urlInput}, should be http: or http
- maxResponseSize must be a positive finite number
AI-assisted analysis of neoclide/coc.nvim@50e974d969 (2026-08-31).
Data as JSON: /api/errors/e4b1b28424f16287.
Report an issue: GitHub.