SOCKS5 proxy not working? Every error, tested, with the fix
SOCKS5 proxy not working? The exact errors curl, Python requests, Node, Chrome and Firefox print for each mistake, from a dated loopback test, and each fix.

Quick summary · TL;DR
- Read the exact words before changing anything. Two strings that look alike need different fixes. "No authentication method was acceptable" means no login was sent at all. "User was rejected" or "SOCKS5 authentication failed" means a login was sent and was wrong.
- A hang or an "invalid version" usually means the wrong protocol on that port. Check the port before you blame the login. In curl, an HTTP port given as socks5h either timed out or printed "Received invalid version in initial SOCKS5 response", depending on the HTTP server.
- Chrome cannot log in to a SOCKS5 proxy. Credentials in --proxy-server gave net::ERR_NO_SUPPORTED_PROXIES in Chrome 157, and Playwright refused at launch. A browser job with a login needs the HTTP endpoint.
- If socks5 fails and socks5h works, the lookup moved, not the proxy. In the test, curl, requests and Node resolved localhost to ::1 and the IPv4 target refused it. Letting the proxy resolve the name fixed it.
SOCKS5 proxy not working? The client almost always says which line is wrong, just badly. A refused connection points at the port, and “No authentication method was acceptable” means the login never got sent. “Can’t complete SOCKS5 connection … (4)” is the proxy failing to resolve the name. The quietest case is no error with an IP that never changes, because the client skipped the proxy without saying so.
Every error string quoted below was printed during one loopback test run on 5 November 2026 (UTC) on macOS 26, with these clients:
- curl 8.7.1
- Python requests 2.34.2 with PySocks 1.7.1
- Node 24.14.1 with socks-proxy-agent 10.1.0
- Chrome 157 headless
- a Playwright build of Firefox 132
The proxies were small test servers on 127.0.0.1, so nothing here is about any provider. Windows and Linux were not tested. The wording should carry over where the same library runs, but the errno numbers in brackets come from macOS, so match on the words rather than the numbers. A refused connection that macOS reports as [Errno 61] is Winsock error 10061, WSAECONNREFUSED, in Microsoft’s Winsock error list.
SOCKS5 proxy not working: four steps
A SOCKS5 connection fails at one of four steps. Each has its own family of errors, so knowing which step broke saves most of the guessing.
- TCP to the proxy. Wrong host, wrong port, firewall. You get “connection refused” or a timeout before any SOCKS bytes move.
- The greeting and login. The client offers auth methods, the server picks one, then RFC 1929 sends the username and password. A missing or wrong login fails here.
- The CONNECT request. The client asks for a target as an IP or a hostname. The server answers with a one-byte reply code from RFC 1928 (1996): 0x03 network unreachable, 0x04 host unreachable, 0x05 connection refused, 0x07 command not supported, 0x08 address type not supported. A 3 often means the proxy has no route to that address family, for example an IPv6 target on a proxy with IPv4 only.
- The traffic itself. The tunnel is up and the target blocks you or returns an error. That is a site problem, not a proxy problem.
Protocol mix-ups break step 2 in strange ways, because the two sides are not even speaking the same language. That’s the source of the odd strings like “invalid version” or “HTTP/0.9”.
Find your error
Search this table for the words you see. Each row gives the client, then the exact text it printed in the test run.
| Client | What it printed | Cause | Fix |
|---|---|---|---|
| curl | curl: (7) Failed to connect to 127.0.0.1 port 11099 after 0 ms: Couldn't connect to server | Nothing listens on that port | Check host and port from your dashboard |
| curl | curl: (97) No authentication method was acceptable. | Server needs a login, none sent | Add USERNAME:PASSWORD@ or --proxy-user |
| curl | curl: (97) User was rejected by the SOCKS5 server (1 1). | Wrong username or password | Re-copy the login; encode special characters |
| curl | curl: (97) Can't complete SOCKS5 connection to intranet.example. (4) | Proxy could not resolve the hostname | Use socks5:// for names only you can resolve |
| curl | curl: (97) Received invalid version in initial SOCKS5 response. | That port speaks HTTP, not SOCKS5 | Use http:// for it, or the SOCKS5 port |
| curl | curl: (56) Recv failure: Connection reset by peer | SOCKS5 port given as http:// or with no scheme | Write socks5h:// in front |
| curl | curl: (5) Unsupported proxy syntax in '...': Bad hostname | An unencoded @ in the password | Percent-encode it as %40 |
| curl | curl: (5) Unsupported proxy syntax in '...': Port number was not a decimal number between 0 and 65535 | An unencoded / in the password | Percent-encode it as %2F |
| Python | InvalidSchema: Missing dependencies for SOCKS support. | PySocks not installed | pip install "requests[socks]" |
| Python | All offered SOCKS5 authentication methods were rejected | No login sent | Put the login in the proxy URL |
| Python | SOCKS5 authentication failed | Wrong login | Re-copy it |
| Python | 0x04: Host unreachable | Proxy could not resolve the name | socks5:// for internal names |
| Python | 0x05: Connection refused | Target refused, often localhost sent as ::1 | Use socks5h:// or 127.0.0.1 |
| Node | Received invalid Socks5 initial handshake (no accepted authentication type) | No login sent | Add it to the URL |
| Node | Socks5 proxy rejected connection - ConnectionRefused | Target refused, often localhost sent as ::1 | Use socks5h:// or 127.0.0.1 |
| Chrome | net::ERR_NO_SUPPORTED_PROXIES | Login or socks5h in --proxy-server | Chrome takes neither; see below |
| Chrome | net::ERR_SOCKS_CONNECTION_FAILED | Login required, name not resolvable, or not a SOCKS5 port | Check the server log; for logins use an HTTP endpoint |
| Chrome | net::ERR_PROXY_CONNECTION_FAILED | Nothing on that port | Check host and port |
In curl’s “Can’t complete” line, the trailing number is the RFC 1928 reply code, and it is the most useful digit in the whole message. (4) is a resolution problem on the proxy side and (5) means the target port refused.
SOCKS5 errors in curl
Most people test with curl first, and that’s the right call because -v shows every step. Exit code 97, which most of the SOCKS lines above carry, is CURLE_PROXY, a proxy handshake error in the libcurl error list (checked 5 November 2026), and the text after it is the part worth reading. Two lines in the verbose output matter more than the rest:
curl -v -x socks5h://USERNAME:PASSWORD@HOST:PORT https://example.com/ -o /dev/null
# * SOCKS5 connect to app.localhost:18080 (remotely resolved)
# * SOCKS5 request granted.
“remotely resolved” means socks5h sent the hostname. With plain socks5 the same line reads “(locally resolved)” and shows the IP your machine picked, which is how the localhost case below was caught.
Wrong login, two servers, two strings. The same wrong password gave (1 1) against the Python test server and (1 2) against microsocks (built from commit 307950c, 24 September 2026). The second number is the server’s RFC 1929 status byte, and any nonzero value means rejected, so don’t read meaning into the exact digit.
An HTTP port given as socks5. This one depends on the HTTP server. One that answered the SOCKS greeting with HTTP/1.1 400 at once produced Received invalid version in initial SOCKS5 response., because curl read the letter H as a version byte. One that waited for a full request line just hung until curl’s -m 5 limit fired: curl: (28) Connection timed out after 5008 milliseconds. Without -m you’d wait for the server’s own timeout, which is why a hang is worth suspecting as a protocol mismatch.
The reverse, a SOCKS port given as http. Forgetting the scheme does the same thing, because curl treats a bare HOST:PORT as an HTTP proxy. The Python server reset the connection (curl: (56) Recv failure: Connection reset by peer), while microsocks sent a SOCKS reply that curl tried to read as HTTP and gave curl: (1) Received HTTP/0.9 when not allowed. An https:// proxy scheme on a SOCKS port failed the TLS handshake with curl: (35).
A SOCKS4-only server. Given socks5h, it hung up on the first byte: curl: (97) Recv failure: Connection reset by peer. The same server worked at once with socks4a://. Pointing socks4:// at a SOCKS5 server failed too, with a reset from the Python server and curl: (97) connection to proxy closed from microsocks. SOCKS4 and SOCKS5 share a name and a port number habit, nothing else, and the SOCKS5 vs HTTP proxy guide covers what the versions carry.
A password with @ in it. curl refused the URL outright with Bad hostname. A / is worse, because curl then reads the rest as a path and complains about the port instead: the password p@ss:w/rd gave Port number was not a decimal number between 0 and 65535, even with the @ encoded. Encoded as p%40ss%3Aw%2Frd, the same login worked in curl, requests and socks-proxy-agent, and --proxy-user 'USERNAME:p@ss:w/rd' worked unencoded, because the URL parser never sees it. The curl proxy guide has the full encoding list.
Python requests and PySocks
The first SOCKS error most Python users meet has nothing to do with the proxy. Without PySocks installed, requests 2.34.2 stops before connecting:
requests.exceptions.InvalidSchema: Missing dependencies for SOCKS support.
Install the extra in the same environment the script runs in, which the requests docs give as python -m pip install 'requests[socks]'. A virtualenv that differs from the one your editor runs is the usual reason it “still” fails after installing.
proxy = "socks5h://USERNAME:PASSWORD@HOST:PORT"
r = requests.get("https://example.com/", proxies={"http": proxy, "https": proxy}, timeout=10)
Then come the traps the test turned up:
- One key missing, no error. With only an
httpskey and anhttp://target, requests went straight to the target. The proxy logged nothing, the request returned 200, and nothing looked wrong. Always set both keys. - The error names the target, not the proxy. A wrong proxy port printed
SOCKSConnection(host='app.localhost', port=18080): ... [Errno 61] Connection refused. The host and port there belong to the site, so it’s easy to go and debug the site when the real problem is the proxy port. - A typo gives a misleading hint.
sock5://producedProxy URL had unsupported scheme sock5, should use http:// or https://, which suggests SOCKS is unsupported. It is supported. The scheme is just misspelled. - HTTP port as socks5h. A server that answered at once gave
SOCKS5 proxy server sent invalid data. One that waited gave aConnectTimeoutafter the 5 second timeout.
One difference from curl: an unencoded @ in the password did not break requests. The test server received the full four-character password, so urllib3 2.8.0 split the URL at the last @. Encoding it anyway costs nothing and keeps the same URL working in curl. The Python requests proxy guide covers sessions and environment variables.
Node: agents and the built-in proxy
Node’s own http module has no SOCKS client, so most code uses socks-proxy-agent. Its errors are readable once you know the pattern, Socks5 proxy rejected connection - followed by the reply code’s name, such as HostUnreachable or ConnectionRefused. A missing login shows as Received invalid Socks5 initial handshake (no accepted authentication type) and a wrong one as Socks5 Authentication failed.
The surprising one is Node’s built-in proxy support. Node 24 can read proxy variables when NODE_USE_ENV_PROXY=1 or --use-env-proxy is set, and the Node HTTP docs (added in v24.5.0 and v22.21.0) list only HTTP and HTTPS proxy URLs. With HTTP_PROXY=socks5h://..., Node 24.14.1 did not skip the variable. It crashed on startup, before any of the script ran:
InvalidArgumentError: Invalid URL protocol: the URL must start with `http:` or `https:`.
Its stack trace points into undici’s EnvHttpProxyAgent and carries code: 'UND_ERR_INVALID_ARG'. If a CI job dies before your first log line, check whether something exported a socks URL into HTTP_PROXY. That’s an easy one to miss, because curl and Python accept the same variable happily. The fix is to give the built-in support what it reads: with HTTP_PROXY=http://HOST:PORT pointing at an HTTP proxy, the same script started and fetched its page, and the proxy logged the request. Keep SOCKS5 in code through socks-proxy-agent.
Chrome and Firefox: the login gap
Chrome cannot log in to a SOCKS5 proxy. The Chromium proxy documentation (checked 5 November 2026) says no SOCKSv5 authentication methods are supported, and the test showed what that looks like:
- Credentials inside
--proxy-server=socks5://USERNAME:PASSWORD@HOST:PORTgavenet::ERR_NO_SUPPORTED_PROXIES. Chrome refuses the whole proxy string rather than ignoring the login. - No credentials against a server that requires them gave
net::ERR_SOCKS_CONNECTION_FAILED. In the server log, Chrome offered only method 0x00, no authentication. socks5h://is not a Chrome scheme and also gaveERR_NO_SUPPORTED_PROXIES. It doesn’t need it: the same doc says that for SOCKS5, name resolution is always done on the proxy side, and the server log showed hostnames arriving.- Playwright stops earlier. Both Playwright 1.59.1 with Chrome 157 and 1.49.1 with its Firefox build threw
Browser does not support socks5 proxy authenticationat launch.
For a browser that needs a login, the practical route is an HTTP proxy endpoint, which Chrome and Playwright can authenticate to. In the test, Playwright’s proxy option with server: "http://HOST:PORT" plus a username and password loaded the page in both Chrome 157 and the Firefox build, and the HTTP test proxy logged a valid Proxy-Authorization header. Headless Chrome pointed at the same proxy with no login gave net::ERR_INVALID_AUTH_CREDENTIALS. Every proxymint tier logs in with a username and password and includes both HTTP and SOCKS5, so the HTTP endpoint is there for browser jobs and SOCKS5 stays for the tools that can send a login.
Firefox, labelled
Only Playwright’s patched Firefox 132 build was run here, with a fresh profile, so treat this as indicative rather than proof for stock Firefox. With the SOCKS5 host set in prefs, Firefox sent hostnames to the proxy by default. Turning network.proxy.socks_remote_dns and network.proxy.socks5_remote_dns off made it resolve locally, and a name only the proxy knew failed with NS_ERROR_UNKNOWN_HOST. Stock Firefox should behave the same way. Firefox’s pref list sets network.proxy.socks5_remote_dns to true and describes it as making a SOCKS5 proxy socks5h by convention, while socks_remote_dns now covers SOCKS4 only and defaults to false. That split landed in Firefox 128 (bug 1741375), so an older Firefox resolves locally unless the old pref was turned on. Against the login-only server it gave NS_ERROR_CONNECTION_REFUSED, since the test profile had no pref that carries a SOCKS username.
Extensions are the documented way around that. MDN’s ProxyInfo reference lists username and password fields usable with SOCKS. That path was not tested here.
DNS leaks and the localhost trap
With socks5:// your client resolves the hostname and sends an IP. With socks5h:// it sends the name and the proxy resolves it. The test showed both sides of that trade:
- A name that only the client could resolve, mapped with curl’s
--resolve, worked over socks5:// and failed over socks5h:// with reply code 4. Internal hostnames and hosts-file entries need plain socks5. localhostbroke the other way. curl, requests and Node resolved it to::1first, sent that IPv6 address to the proxy, and the IPv4-only target refused it:Can't complete SOCKS5 connection to app.localhost. (5). socks5h:// worked because the proxy resolved the name itself. The forum fix “use 127.0.0.1 instead of localhost” comes from the same IPv4 and IPv6 split, though in those threads localhost is often the proxy host, and that case did not fail here: curl and requests fell back to 127.0.0.1 when the proxy was given as localhost.
For public sites, the local lookup is the leak: your resolver sees every hostname even though the traffic exits elsewhere. The proxy DNS leak test shows how to confirm which resolver asked. On proxymint’s gateway, Lab #1 measured socks5h resolving on the proxy side on one residential and one mobile package (28 September 2026).
UDP over SOCKS5
SOCKS5 can carry UDP, but only if both ends implement UDP ASSOCIATE, and most everyday clients don’t use it at all. curl, requests, Node agents and Chrome send TCP only, and the Chromium doc says outright that its SOCKS5 support cannot relay UDP. So QUIC and HTTP/3 never go through a SOCKS5 proxy in Chrome. That’s expected, not a fault.
PySocks does implement it. A socksocket(AF_INET, SOCK_DGRAM) sent a datagram through the Python test server and got the echo back. microsocks and the server with UDP turned off both answered the ASSOCIATE request with reply 0x07, which PySocks printed as SOCKS5Error: 0x07: Command not supported, or protocol error. Asking for UDP on a SOCKS4 proxy type failed locally with UDP only supported by SOCKS5 proxy type.
Two details from RFC 1928 explain the odd behaviour people report. The UDP association ends when the TCP connection that requested it closes, so a client that drops the control connection loses its relay. And a server without fragmentation support must drop any datagram whose FRAG field is not zero. If UDP matters to you, test it on the exact server you will use, because support varies from server to server.
SOCKS5 proxy not working: what to do next
When a SOCKS5 proxy is not working, match the symptom to the step and fix only that:
- Refused or timed out before any SOCKS text: host or port. Copy them again, then check for a firewall between you and the proxy.
nc -vz HOST PORTanswers that in one line. - “No acceptable” or “rejected” wording: the login. Put it in the URL, encode
@,:and/, and check you didn’t paste a space. - “invalid version”, “HTTP/0.9” or a reset on the first byte: wrong protocol for that port. HTTP port, SOCKS4 server or a missing scheme.
- Reply code 3, 4 or 5, or
HostUnreachable: the target, the lookup or the proxy’s own route. Switch between socks5 and socks5h and see which one works. - Works, but the IP never changes: the client skipped the proxy. Check for a missing requests key, a
NO_PROXYmatch or, with a local target, Chrome’s loopback bypass. - Chrome with a login: use the HTTP endpoint. Chrome will not send a SOCKS5 login.
Test it in five commands
Run these in order and stop at the first one that fails. Each one isolates one step from the list at the top.
nc -vz HOST PORT # 1. is the port open
curl -v -x socks5h://HOST:PORT https://example.com/ -o /dev/null # 2. greeting without a login
curl -v -x socks5h://USERNAME:PASSWORD@HOST:PORT https://example.com/ -o /dev/null # 3. login
curl -v -x socks5://USERNAME:PASSWORD@HOST:PORT https://example.com/ -o /dev/null # 4. local DNS, compare with 3
curl -x socks5h://USERNAME:PASSWORD@HOST:PORT https://api.ipify.org # 5. exit IP
If command 2 says “No authentication method was acceptable” and 3 works, the login is the whole story. If 3 works and your app doesn’t, the problem is the app’s proxy handling, so look at its scheme, its keys or its bypass list. A fixed IPv4 port from datacenter proxies or any other static endpoint makes this comparison cleaner, because the exit in step 5 should be the same on every run.
Frequently asked questions
One of four steps failed, and running curl -v shows which: TCP to the proxy, the login, the CONNECT request or the target. A refused connection or timeout before any SOCKS message is the host or port. Authentication wording points at the login. A reply code such as 4 or 5 points at the target or the DNS lookup.
Copy the username and password again and check for spaces. Percent-encode characters such as @ and : inside the proxy URL, or pass the login separately, for example with curl --proxy-user. An error saying no method was acceptable is a different case. The client never sent a login, so add it to the proxy URL.
Chrome supports no SOCKS5 authentication methods, according to the Chromium proxy documentation. A proxy that needs a username and password fails with net::ERR_SOCKS_CONNECTION_FAILED, or with ERR_NO_SUPPORTED_PROXIES when the login is put in the proxy string. Firefox can pass SOCKS credentials through an extension. For Chrome, use an HTTP proxy endpoint with the same job.
Exit code 97 is CURLE_PROXY, a proxy handshake error, and curl prints the detail after it. "No authentication method was acceptable" is a missing login, "User was rejected" a wrong one, and "Can't complete SOCKS5 connection" ends with the reply code from the proxy, where 4 means host unreachable and 5 connection refused.
Check the port with nc, then run curl -v through the proxy without a login, with the login, and once each with socks5 and socks5h. Finally fetch an IP echo page through the proxy and confirm the exit IP is the proxy, not your own. Stop at the first command that fails, because that is the broken step.
The protocol does, through the UDP ASSOCIATE command in RFC 1928, but the server must implement it and the client must ask for it. Many servers answer with reply 0x07, command not supported. curl, Python requests and Chrome only send TCP through SOCKS5, so QUIC and HTTP/3 do not use the proxy.
It can. With socks5:// the client resolves the hostname itself, so your own resolver sees every name you visit. With socks5h:// the hostname goes to the proxy and the proxy resolves it. Chrome always resolves on the proxy side for SOCKS5, and Firefox did so by default in the test.
Researched and drafted with AI tools, then checked against our publishing rules before it went live: 10 outside links, 6 links to other proxymint pages, no prices and a fact-check pass against our product records. How we write.
