ERR_PROXY_CONNECTION_FAILED: you never reached the proxy
What you see
net::ERR_PROXY_CONNECTION_FAILEDError: net::ERR_PROXY_CONNECTION_FAILEDpage.goto: net::ERR_PROXY_CONNECTION_FAILEDplaywright._impl._api_types.Error: net::ERR_PROXY_CONNECTION_FAILED
More error strings (7)
org.openqa.selenium.WebDriverException: unknown error: net::ERR_PROXY_CONNECTION_FAILEDProxyError('Unable to connect to proxy', NewConnectionError(ProxyError('Cannot connect to proxy.'curl: (7) Failed to connect tocurl: (5) Could not resolve proxyError: connect ECONNREFUSED 127.0.0.1:1080TypeError: fetch failed
What it means
Your browser or script never reached the proxy (the middleman server your traffic goes through). Nothing was sent anywhere, so the website never saw you. The fault is the proxy address, or its port, or the road from your computer to it.
Why it happens
First: did you reach the proxy at all?
Proxy errors look alike and each one breaks at a different spot. This one breaks before the proxy says a single word.
| you see | where it broke | go to |
|---|---|---|
net::ERR_PROXY_CONNECTION_FAILED (-130) |
on the way to the proxy: name not found or connection failed | this page |
net::ERR_TUNNEL_CONNECTION_FAILED (-111) |
at the proxy: it answered, but would not open the tunnel to the site | /errors/err-tunnel-connection-failed |
407 Proxy Authentication Required |
at the proxy: it wants a login | /errors/407-proxy-authentication-required |
Chromium’s own comment for -130 says the code does NOT include failures during the CONNECT step. A proxy that answers with any status number is a tunnel problem or a login problem, not this one.
The usual causes, most common first
- Wrong host or port. Chromium’s docs describe this exact case: proxy unreachable, every request fails with
ERR_PROXY_CONNECTION_FAILED. - The proxy is down. That includes a local helper proxy on your own machine: in selenium-wire issue #51, the tool’s local proxy refused connections (
ConnectionRefusedError: [Errno 61] Connection refused), and every new tab gaveERR_PROXY_CONNECTION_FAILED. - Wrong scheme. Without one, Chrome assumes an HTTP proxy.
https://means Chrome speaks TLS (encryption) to the proxy itself.socks5://means a SOCKS proxy. In Puppeteer issue #2472,--proxy-server=https://IP:Portfailed with this error while curl went through fine. - Your IP isn’t allowed in. Some providers check your IP instead of a password. ProxyMesh says too many 402, 407 or 408 replies get your IP blocked for 4 to 6 hours, and lists “Connection Refused” and “Cannot Connect to Proxy” among the signs.
- A firewall blocks the port on the way out. ProxyMesh says some hosting providers block traffic going out to its port 31280, and on AWS EC2 you may have to allow it yourself.
- Your tool’s proxy setup. Playwright, Selenium and SOCKS5 logins each have a trap. See Dev details.
Still, not every provider just drops the connection. Bright Data answers an IP that is missing from your zone’s allowlist with error client_10030: “not whitelisted in this zone’s settings”. That is an answer, so in a browser it shows up as a tunnel or 407 error rather than this one.
Reaching a proxy takes two small steps. First Chrome turns the proxy’s name into a numeric IP (a DNS lookup). Then it opens a TCP connection (the basic line between two machines) to that IP and port. Either step fails: -130. Chromium’s fallback rules name the same two steps as “connection level failures”.
“Refused” and “timed out” point to different things. Node’s docs say a refused connection usually means no service is listening on that port. A timeout means the other side stayed silent.
IP login has its own traps. ProxyMesh says one IP can’t sit on two accounts since the proxy can’t tell who is sending. Shared office IPs run into it. Its advice: run from your own cloud server. ProxyMesh also says a 408 timeout can reach you as ERR_PROXY_CONNECTION_FAILED, so a few of these in a long run may just need a retry.
Fix it
- Copy host, port number and scheme again from your provider’s dashboard. No typos, no port from another product.
- Test the proxy by itself with curl, outside your code:
curl -v -x http://proxy.example:8080 https://example.comcurl: (5) Could not resolve proxy: proxy.example: the proxy’s name is wrong, or DNS cannot find it.curl: (7) Failed to connect to …: the port is closed or the proxy is down, or something blocks the way.CONNECT tunnel failed, response 502(or some other number): you did reach the proxy. Go to /errors/err-tunnel-connection-failed.- A
407: follow /errors/407-proxy-authentication-required.
- Using IP login? Add your current public IP to the provider’s allowed list. Bright Data calls it “Allowed IPs”. Hit a block after too many errors? ProxyMesh says to wait out the ban.
- Open the port on your side. On a cloud server you have to allow outgoing traffic headed for the proxy’s port in its firewall settings.
- curl works, the browser fails? The proxy is fine, so the bug is how your code passes it in. Check the Playwright and Selenium traps below.
- Python, Node or curl fails the same way? Same cause, different words. See the HTTP clients part of Dev details, or /errors/python-requests-proxyerror for every requests message.
- Don’t “fix” it with
direct://. Chrome’s docs show--proxy-server="http://foo:8080,direct://"as a fallback. That works, but then your traffic leaves on your own IP.
Why curl first? It takes your code out of the picture: if curl can’t connect either, no Puppeteer or Playwright setting will fix it.
Read the exit code as a place: in libcurl’s list, 5 means it could not resolve the proxy’s name. 7 means it could not connect to the host or proxy. Neither means the proxy said no: a proxy that says no sends a status, and curl prints it.
Our advice: run the same curl from a second network, like a cloud server. Works there? Then the proxy is fine, and the block sits on your side: a firewall rule, or an IP the provider does not know.
About direct://: Chrome tries the list left to right. With direct:// last, a dead proxy sends Chrome to the site itself, and the site sees your real IP. For scraping, a loud error beats a quiet leak.
Paste this into your AI
My scraper cannot reach its proxy. The exact error:
"<paste the full error line, including any 'cause' or 'Caused by' part>"
First tell me in plain words: did I fail to reach the proxy at all,
or did the proxy answer and refuse (a tunnel error or a 407)?
Then list the likely causes in order, most likely first.
For each cause, give one quick test and one fix.
Show me a curl -v command that tests my proxy alone, and how to read curl exit codes 5 and 7.
My setup: <Puppeteer / Playwright / Selenium / requests / curl / Node fetch or axios>,
how I pass the proxy (<--proxy-server flag / proxy option / env var HTTP_PROXY / proxies dict>),
proxy URL: <scheme://host:port, no password>,
how the provider checks me (<username+password / my IP on an allowlist>),
where the code runs (<laptop / office network / cloud server / Docker>).
Never ask me to paste my real password.Dev details
Chromium spells out the code in net/base/net_error_list.h:
// Could not create a connection to the proxy server. An error occurred
// either in resolving its name, or in connecting a socket to it.
// Note that this does NOT include failures during the actual "CONNECT" method
// of an HTTP proxy.
NET_ERROR(PROXY_CONNECTION_FAILED, -130)
How it looks in every browser tool:
Puppeteer: Error: net::ERR_PROXY_CONNECTION_FAILED at https://example.com/
Playwright (Node): page.goto: net::ERR_PROXY_CONNECTION_FAILED at http://localhost:8000/
Playwright (Py): playwright._impl._api_types.Error: net::ERR_PROXY_CONNECTION_FAILED at https://www.example.com/
Selenium (Java): org.openqa.selenium.WebDriverException: unknown error: net::ERR_PROXY_CONNECTION_FAILED
Schemes and default ports in Chrome
From Chromium’s proxy docs. Leave out the port and Chrome picks the scheme’s default:
| scheme | default port |
|---|---|
http:// (also the default when you write no scheme) |
80 |
https:// |
443 |
socks4:// |
1080 |
socks5:// |
1080 |
A port such as 8080 with no scheme means “HTTP proxy on 8080”. If that port speaks SOCKS, write socks5://.
Playwright: two traps
per-context with no context proxy. Issue #9437: starting the browser with proxy={'server': 'per-context'} and then calling new_context() without a proxy fails on every page. A maintainer explained that per-context is a placeholder, and you must set the real proxy on each context:
const browser = await chromium.launch({ proxy: { server: 'per-context' } });
const context = await browser.newContext({
proxy: { server: 'http://proxy.example:8080', username: 'user', password: 'pass' },
});
localhost goes through the proxy. Playwright adds Chrome’s <-loopback> rule that sends loopback traffic through the proxy, unless you opt out. From crBrowser.ts:
export function shouldProxyLoopback(bypass: string | undefined) {
if (process.env.PLAYWRIGHT_DISABLE_FORCED_CHROMIUM_PROXIED_LOOPBACK)
return false;
const hosts = (bypass || '').split(',').map(s => s.trim());
const shouldBypassSomeLoopback = ['localhost', '127.0.0.1', '::1', '[::]', '[::1]', '<loopback>', '<-loopback>'].some(host => hosts.includes(host));
return !shouldBypassSomeLoopback;
}
So a dummy proxy plus a local test server gives ERR_PROXY_CONNECTION_FAILED on http://localhost:8000/. The fix is to put localhost in proxy.bypass.
Selenium: SOCKS5 with a login
In Selenium issue #12910 (Selenium 4.13.0, Chrome 117), a SOCKS5 proxy with username and password failed both ways: Selenium’s Proxy object with setSocksUsername, and --proxy-server=socks5://user:pass@host:port. Both ended in ERR_PROXY_CONNECTION_FAILED. The issue was marked as a ChromeDriver problem. Chromium’s proxy docs are blunt: “No authentication methods are supported for SOCKSv5 in Chrome”. Ask your provider for an HTTP endpoint (more in /errors/err-tunnel-connection-failed).
HTTP clients: same failure, other words
Python (requests, urllib3). urllib3 wraps errors from setting up the proxy connection, tunnel step included, into ProxyError("Unable to connect to proxy", …). Version 1.26 says Cannot connect to proxy. instead. Look at the cause inside:
ProxyError('Unable to connect to proxy', NewConnectionError(… Connection refused)) → this page
ProxyError('Unable to connect to proxy. Your proxy appears to only use HTTP and not HTTPS, …') → https:// on an HTTP proxy: write http://
The second one is urllib3 guessing a scheme mismatch based on TLS errors like wrong version number. Every other requests message: /errors/python-requests-proxyerror.
curl. Two exit codes both mean “never reached the proxy”:
| exit | name | libcurl says |
|---|---|---|
| 5 | CURLE_COULDNT_RESOLVE_PROXY |
the given proxy host could not be resolved |
| 7 | CURLE_COULDNT_CONNECT |
failed to connect() to host or proxy |
The wording in curl’s current code:
curl: (5) Could not resolve proxy: proxy.example
curl: (7) Failed to connect to example.com:443 over proxy proxy.example after 3 ms: Could not connect to server
Node (fetch/undici, axios). You get a bare socket error. The undici example below comes from a discussion where HTTP_PROXY pointed at a port with nothing running:
TypeError: fetch failed
[cause]: Error: connect ECONNREFUSED 127.0.0.1:1080
{ errno: -61, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 1080 }
The trick: compare address and port with your proxy’s. If they match, then the proxy refused you, not the site. What Node’s docs say:
ECONNREFUSED: the other machine actively refused, usually because no service runs there.ENOTFOUND: the DNS lookup failed (bad proxy host name).ETIMEDOUT: the other side did not answer within the limit.
Backup proxies
Chrome takes a comma-separated list in --proxy-server and tries the next proxy on a failure. Chromium’s docs say that generally only connection-level failures count, and that is exactly this error. A refused tunnel does not count. Use a second real proxy, not direct://.
Chrome remembers which proxies failed. A proxy that fails gets marked bad for the next 5 minutes, and Chrome tries the others first. The failures that count are the ones on this page: a failed DNS lookup for the proxy, or a failed TCP connection to it.
That localhost trap in Playwright starts with a Chrome safety rule. By default Chrome never sends localhost, 127.0.0.1/8 or [::1] through a proxy, because the web treats localhost as a secure origin. The special rule <-loopback> switches that off. Playwright adds it unless your bypass list names a loopback host.
In Node, address holds an IP, not a name. The undici asker noticed that a proxy set by host name resolves to an IP, so matching it against your config string can miss. Resolve the name first, or wrap the client: an undici maintainer pointed to a custom clientFactory on EnvHttpProxyAgent.
Questions
What is the difference between ERR_PROXY_CONNECTION_FAILED and ERR_TUNNEL_CONNECTION_FAILED?
ERR_PROXY_CONNECTION_FAILED (-130): Chrome never reached the proxy. Its name did not resolve or the connection failed. ERR_TUNNEL_CONNECTION_FAILED (-111): Chrome reached the proxy, but the CONNECT step that opens the tunnel failed. Chromium's own comment for -130 says it does not cover CONNECT failures.
Why does Playwright give ERR_PROXY_CONNECTION_FAILED when I launch with proxy server 'per-context'?
'per-context' is only a placeholder. In Playwright issue #9437, a maintainer explained you then have to pass the real proxy to every new context. A context with no proxy fails on every page with this error.
Why does my localhost test page fail with ERR_PROXY_CONNECTION_FAILED in Playwright?
Playwright sends localhost through your proxy too, unless your bypass list names a loopback address such as localhost or 127.0.0.1, or you set PLAYWRIGHT_DISABLE_FORCED_CHROMIUM_PROXIED_LOOPBACK (Playwright source, crBrowser.ts). If that proxy is a dummy or down, localhost fails.
Related
Tools that get past it
| Tool | Price |
|---|---|
| Free | |
| Free | |
| Free | |
| Free | |
| Free |
Sources
Chromium source: net_error_list.h (PROXY_CONNECTION_FAILED, -130) chromium.googlesource.com
Chromium docs: Proxy support in Chrome (unreachable proxy, schemes, default ports, direct:// fallback) chromium.googlesource.com
puppeteer/puppeteer issue #2472: ERR_PROXY_CONNECTION_FAILED with --proxy-server github.com
microsoft/playwright issue #9437: ERR_PROXY_CONNECTION_FAILED when server 'per-context' was set but no proxy given github.com
microsoft/playwright issue #39562: proxy.bypass localhost,127.0.0.1 does not work github.com
Playwright source: crBrowser.ts (shouldProxyLoopback) github.com
SeleniumHQ/selenium issue #12910: SOCKS5 proxy with login, WebDriverException net::ERR_PROXY_CONNECTION_FAILED github.com
wkeeling/selenium-wire issue #51: ERR_PROXY_CONNECTION_FAILED after clicking any link github.com
urllib3 source: connection.py (_wrap_proxy_error, 'Unable to connect to proxy') github.com
urllib3 source: connectionpool.py (wraps errors before the proxy is reached) github.com
urllib3 1.26.x source: connectionpool.py ('Cannot connect to proxy.') github.com
libcurl: error codes (CURLE_COULDNT_RESOLVE_PROXY 5, CURLE_COULDNT_CONNECT 7) curl.se
curl source: cf-ip-happy.c ('Failed to connect to … over proxy …') github.com
curl source: vdns/hostip.c ('Could not resolve proxy') github.com
curl source: strerror.c (error texts) github.com
Node.js docs: Errors (ECONNREFUSED, ENOTFOUND, ETIMEDOUT) nodejs.org
nodejs/undici discussion #4333: Error handling for EnvHttpProxyAgent (proxy down → ECONNREFUSED) github.com- ProxyMesh Knowledge Base: Proxy Connection Problems docs.proxymesh.com
Bright Data Docs: Proxy errors troubleshooting (client_10030, IP not on allowlist) docs.brightdata.com