{"record":{"id":"e4b1b28424f16287","repo":"neoclide/coc.nvim","slug":"request-failed-using-proxy-proxy-host-err-me","errorCode":null,"errorMessage":"Request failed using proxy ${proxy.host}: ${err.message}","messagePattern":"Request failed using proxy (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/model/fetch.ts","lineNumber":330,"sourceCode":"/**\n * Send request to server for response, supports:\n *\n * - Send json data and parse json response.\n * - Throw error for failed response statusCode.\n * - Timeout support (no timeout by default).\n * - Send buffer (as data) and receive data (as response).\n * - Proxy support from user configuration & environment.\n * - Redirect support, limited to 3.\n * - Support of gzip & deflate response content.\n */\nexport default function fetch(urlInput: string | URL, options: FetchOptions = {}, token?: CancellationToken): Promise<ResponseResult> {\n  let url = toURL(urlInput)\n  let opts = resolveRequestOptions(url, options)\n  return request(url, options.data, opts, token).catch(err => {\n    logger.error(`Fetch error for ${url}:`, opts, err)\n    if (opts.agent && opts.agent.proxy) {\n      let { proxy } = opts.agent\n      throw new Error(`Request failed using proxy ${proxy.host}: ${err.message}`)\n    } else {\n      throw err\n    }\n  })\n}\n","sourceCodeStart":312,"sourceCodeEnd":336,"githubUrl":"https://github.com/neoclide/coc.nvim/blob/50e974d9692461a69147d5cab146a8d3e439abe4/src/model/fetch.ts#L312-L336","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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).","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."],"exampleFix":"// before (config)\n{ \"http.proxy\": \"http://127.0.0.1:8080\" } // proxy down\n// after\n{ \"http.proxy\": \"\" } // or point at the correct proxy\n// then retry the fetch","handlingStrategy":"retry","validationCode":"const net = require('net')\nasync function proxyReachable(host, port) {\n  return new Promise(res => {\n    const s = net.connect({ host, port, timeout: 3000 }, () => { s.destroy(); res(true) })\n    s.on('error', () => res(false)); s.on('timeout', () => { s.destroy(); res(false) })\n  })\n}\n// only call fetch if await proxyReachable(proxyHost, proxyPort)","typeGuard":null,"tryCatchPattern":"try {\n  return await fetch(url)\n} catch (e) {\n  const m = /^Request failed using proxy (.+?): (.*)$/.exec(e.message)\n  if (m) {\n    logger.warn(`proxy ${m[1]} failed: ${m[2]}; retrying without proxy`)\n    return fetchWithoutProxy(url)\n  }\n  throw e\n}","preventionTips":["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."],"tags":["network","proxy","http"],"backgroundTag":"proxy-request-failed","analyzedSha":"50e974d9692461a69147d5cab146a8d3e439abe4","analyzedAt":"2026-08-31T11:17:23.966Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}