ERR_SOCKS_CONNECTION_FAILED: The SOCKS Proxy Did Not Connect

Chrome reached the SOCKS proxy, but the handshake failed. In regular Chrome the most common cause is SOCKS5 with a username and password, which the browser does not support.

Updated · Prokso editorial team

Key takeaways
  • ERR_SOCKS_CONNECTION_FAILED means the handshake with the SOCKS proxy failed
  • In Chrome the most common cause is SOCKS5 with a username and password, which the browser does not support, or a type that does not match the port
  • For SOCKS5 in Chrome turn on IP access, and for username login use HTTP port 823

What the error means

In Chromium's net_error_list.h, code -120 ERR_SOCKS_CONNECTION_FAILED means the browser failed to establish a connection to the SOCKS proxy server for a target host. Code -121 ERR_SOCKS_CONNECTION_HOST_UNREACHABLE means the SOCKS proxy server failed to connect to the target host because that host is unreachable.

The Chromium source code shows exactly when -120 appears for SOCKS5. In its greeting the browser offers only the no-authentication method, and if the server requires another method, such as a username and password, the connection ends with this error. -120 also appears when the server closes the connection during the handshake, replies outside the SOCKS5 protocol or returns any error code, and when the site name is longer than 255 characters.

In current Chromium code, -121 is returned only by the SOCKS4 client. If you see it, the browser is talking to the proxy over SOCKS4, while Prokso port 824 works over SOCKS5. And if the browser cannot even open a TCP connection to the proxy, Chrome shows ERR_PROXY_CONNECTION_FAILED instead of a SOCKS error.

Causes

  • SOCKS5 with a username and password in Chrome. The Chromium documentation states plainly that Chrome supports no authentication methods for SOCKSv5. The gateway asks for a username, the browser does not offer one, and the handshake stops.
  • The proxy type does not match the port. SOCKS5 is selected in the settings, but port 823 is HTTP. The gateway does not reply in the SOCKS5 protocol, and Chrome ends the connection with -120.
  • A socks= entry without a scheme. According to the Chromium documentation, in the rule socks=gw.prokso.com:824 without a scheme the proxy is treated as SOCKS4. That is where -121 comes from when SOCKS5 was expected.
  • An error on the gateway or site side. If the proxy could not connect to the site, it returns a SOCKS5 error code, and Chrome shows -120. More on the general SOCKS server failure and connection refused pages.
  • The wrong type in an antidetect browser profile. A profile has its own fields for type, host, port, username and password. If SOCKS5 is set on an HTTP port or the other way around, the handshake fails in the same way.

How to fix it

  1. Check the type and port pair: SOCKS5 is port 824 (a new IP for every request), HTTP is port 823, and the sticky ports 10000-20000 accept both protocols. Reference on the gateway page.
  2. In regular Chrome, turn on IP access in the dashboard for SOCKS5 (up to 5 addresses): no username is needed then, and the handshake without authentication goes through.
  3. If you need username and password login in Chrome, use an HTTP proxy: for HTTP proxies Chromium supports the Basic, Digest, Negotiate and NTLM schemes.
  4. Write the scheme explicitly in --proxy-server: socks5://gw.prokso.com:824, not socks=gw.prokso.com:824.
  5. Check SOCKS5 access outside the browser: curl -x socks5h://USERNAME:PASSWORD@gw.prokso.com:824 https://prokso.com/ip. curl error (97) with the text "User was rejected by the SOCKS5 server" means a wrong username or password. More examples in the curl guide.

How to check that it works

Open the IP check page in the browser: it should show the proxy address and the country you selected. If ERR_PROXY_CONNECTION_FAILED appears instead of the SOCKS error, the browser cannot open a connection to the gateway itself: check the host, port and network.

Two-minute diagnosis

First paste the line into the proxy checker. If the proxy works there, the cause is in your app or its settings. If not, test the line from a terminal:

curl -v -x "http://USERNAME:PASSWORD@gw.prokso.com:823" https://api.ipify.org
  • A < HTTP/1.1 407 line right after CONNECT means the proxy answered. The name after the code, for example NO_USER, points to the cause.
  • The proxy answered CONNECT with 200 and then another code arrived - the proxy works, and that answer came from the website.
  • No answer at all, only a timeout - the connection never reached the proxy: check the host, port and network.

Setup guides where this error comes up

FAQ

Why does SOCKS5 work in curl and Python but not in Chrome?

curl and Python libraries can send a SOCKS5 username and password. Chrome cannot: according to the Chromium documentation, it supports no authentication methods for SOCKSv5. What SOCKS5 is: see the <a href="/en/glossary/socks5">glossary</a>.

How long does Chrome wait for the SOCKS handshake?

In the Chromium source code, the SOCKS handshake timeout is 30 seconds from the moment the connection to the proxy is already open. If the proxy does not reply for longer, the attempt is aborted.

What if the error happens on only one site?

Then the connection to the proxy works, but the connection to the site fails, and the gateway returns a SOCKS5 error code. Repeat the request: on port 824 it goes through a new IP. If the site is unavailable without a proxy too, the cause is the site itself.

Residential $1.59, mobile $2.50, datacenter $0.65 per GB

Sign up in a minute, get access right after payment.

Create account