Guide · Proxy basics
SOCKS5 proxy errors: curl (97), "General SOCKS server failure" and reply codes 1 to 8
A SOCKS5 connection fails at one of three steps, and the error tells you which. At the greeting the proxy refuses your authentication method (No authentication method was acceptable). At login it rejects the username or password (User was rejected by the SOCKS5 server (1 1)). At the connect step it answers with a reply code from RFC 1928 that says why it could not reach the website: curl prints the code in parentheses, as in curl: (97) Can't complete SOCKS5 connection to example.com. (1), and Python and Node print its name, such as General SOCKS server failure. Exit code 97 is curl's general proxy handshake error. Codes 1 and 6 are failures at the proxy or timeouts and are worth one retry; 2, 4 and 5 point at the target host or port; 7 and 8 at what your client asked for.
Reviewed 14 Nov 2026
The short answer
- curl 8.7.1 reports every SOCKS5 failure as exit 97 (
CURLE_PROXY). The number in parentheses at the end ofCan't complete SOCKS5 connectionis the proxy's RFC 1928 reply code. - "General SOCKS server failure" is reply code 1. RFC 1928 gives it no further meaning, so it only says the proxy could not complete the request.
- With
socks5h://the proxy resolves the hostname, so a misspelled host comes back as reply 4, Host unreachable. Withsocks5://in curl and requests the same typo fails on your own machine. - httpx and aiohttp-socks send the hostname to the proxy even for
socks5://. aiohttp-socks rejects thesocks5h://scheme withValueError: Invalid scheme component: socks5h. - requests raises
ConnectionError, notProxyError, for SOCKS failures, so anexcept ProxyErrorwritten for HTTP proxies does not catch them.
Which step failed: errors by handshake stage
RFC 1928 defines the order: the client lists the authentication methods it supports, the server picks one (or answers X'FF', no acceptable methods), RFC 1929 username/password login runs if it was chosen, then the client sends its CONNECT request and the server answers with a reply code. Reproduced on 2026-11-14 with curl 8.7.1 against local SOCKS5 test servers:
| curl 8.7.1 output | Stage | What it means |
|---|---|---|
curl: (97) No authentication method was acceptable. | Greeting | The proxy requires a username and password and none were sent, so it answered X'FF' |
curl: (97) User was rejected by the SOCKS5 server (1 1). | Login | Wrong username or password. The two numbers are the version and status bytes of the RFC 1929 reply; any non-zero status is a failure |
curl: (97) Can't complete SOCKS5 connection to example.com. (1) | Connect | The proxy could not reach the target; the last number is the reply code (next table) |
curl: (97) Received invalid version in initial SOCKS5 response. | Greeting | The port is not a SOCKS5 server. Ours was an HTTP proxy answering 400 |
curl: (97) connection to proxy closed | Greeting | The server closed the connection without answering |
curl: (97) Could not resolve host: no-such-host.invalid | Before connect | socks5:// resolves the target on your machine, and that failed; with socks5h:// it would be reply 4 |
curl: (7) Failed to connect to 127.0.0.1 port 28099 after 0 ms: Couldn't connect to server | Before SOCKS | Nothing listening on that host and port |
curl: (6) Could not resolve host: no-such-proxy.invalid | Before SOCKS | The proxy's own hostname does not resolve. For HTTP proxies curl uses exit 5 here, for SOCKS proxies exit 6 |
SOCKS5 reply codes 1 to 8 and what to do
The reply code is the second byte of the server's answer to CONNECT; 0 means success. Our test server sent each code on request, and curl printed curl: (97) Can't complete SOCKS5 connection to example.com. (N) for every one. The middle column is what requests 2.34.2 with PySocks 1.7.1 printed.
| Code | RFC 1928 name | PySocks / requests prints | What to check |
|---|---|---|---|
| 1 | general SOCKS server failure | 0x01: General SOCKS server failure | A failure inside the proxy with no detail. Retry once on a new connection; if it repeats, test the same target through the HTTP form of the proxy |
| 2 | connection not allowed by ruleset | 0x02: Connection not allowed by ruleset | The proxy's rules block this destination or port. Retrying will not help |
| 3 | Network unreachable | 0x03: Network unreachable | The proxy has no route to the target's network. Check the target address |
| 4 | Host unreachable | 0x04: Host unreachable | The proxy could not reach the host. Our test server answered 4 when the hostname did not resolve, so check the spelling first |
| 5 | Connection refused | 0x05: Connection refused | The target host refused that port. Check the port in the URL |
| 6 | TTL expired | 0x06: TTL expired | RFC 1928 gives only the name. Treat it as transient: retry once, later |
| 7 | Command not supported | 0x07: Command not supported, or protocol error | The proxy does not support the command the client sent (CONNECT, BIND or UDP ASSOCIATE). Check the client library's settings |
| 8 | Address type not supported | 0x08: Address type not supported | The proxy refuses the address type you sent: IPv4, domain name or IPv6. Switching between socks5:// and socks5h:// changes it |
libcurl exposes the names as CURLINFO_PROXY_ERROR, for example CURLPX_REPLY_GENERAL_SERVER_FAILURE for 1, but the curl 8.7.1 command line has no write-out variable for it: -w '%{proxy_error}' printed unknown --write-out variable. Read the number in parentheses instead.
General SOCKS server failure in each client
The same reply code 1 and the same wrong password, reproduced in six clients on 2026-11-14. Search this table for your client's wording.
| Client (version run) | Reply 1 (general failure) | Wrong password |
|---|---|---|
| curl 8.7.1 | curl: (97) Can't complete SOCKS5 connection to example.com. (1) | curl: (97) User was rejected by the SOCKS5 server (1 1). |
| Python requests 2.34.2 + PySocks 1.7.1 | requests.exceptions.ConnectionError: SOCKSHTTPSConnectionPool(...): Max retries exceeded ... Failed to establish a new connection: 0x01: General SOCKS server failure | ... Failed to establish a new connection: SOCKS5 authentication failed |
| httpx 0.28.1 (socksio 1.0.0) | httpx.ProxyError: Proxy Server could not connect: General SOCKS server failure. | httpx.ProxyError: Invalid username/password |
| aiohttp 3.14.5 + aiohttp-socks 0.12.0 | ProxyError: General SOCKS server failure | ProxyError: Username and password authentication failure |
Node socks-proxy-agent 10.1.0 (socks 2.8.10), with https.get or axios | Error: Socks5 proxy rejected connection - Failure | Error: Socks5 Authentication failed |
| Chrome 157 and Chromium 156 | net::ERR_SOCKS_CONNECTION_FAILED, also for codes 4 and 5 | Chrome has no SOCKS5 login, see ERR_NO_SUPPORTED_PROXIES |
With no credentials sent to a proxy that needs them, the wording changes again: PySocks says All offered SOCKS5 authentication methods were rejected, httpx Requested NO AUTHENTICATION REQUIRED from proxy server, but got NO ACCEPTABLE METHODS., aiohttp-socks No acceptable authentication methods were offered and the Node socks package Received invalid Socks5 initial handshake (no accepted authentication type).
A port that answers in HTTP instead of SOCKS5 shows up as SOCKS5 proxy server sent invalid data (PySocks), socksio.exceptions.ProtocolError: Malformed reply (httpx), Unexpected SOCKS version number: 72 (aiohttp-socks; 72 is the H of HTTP/1.1) and Received invalid Socks5 initial handshake (invalid socks version) (Node).
socks5 vs socks5h: where the hostname is resolved
Requests documents that socks5:// resolves DNS on the client and socks5h:// on the proxy, in line with curl. Not every client follows that rule. Our SOCKS server logged the address type (ATYP) of each CONNECT for https://example.com/:
| Client | `socks5://` sends | `socks5h://` sends |
|---|---|---|
| curl 8.7.1 | An address resolved locally (ATYP 4, IPv6 here) | The hostname (ATYP 3) |
| requests 2.34.2 + PySocks 1.7.1 | An address resolved locally (ATYP 4) | The hostname (ATYP 3) |
| httpx 0.28.1 | The hostname (ATYP 3) | The hostname (ATYP 3) |
| aiohttp-socks 0.12.0 | The hostname (ATYP 3); its rdns option is on by default | Rejected: ValueError: Invalid scheme component: socks5h |
Chrome 157 (--proxy-server) | The hostname (ATYP 3) | Rejected: net::ERR_NO_SUPPORTED_PROXIES |
Why it matters for errors: with local resolution a misspelled hostname fails on your machine (curl: (97) Could not resolve host: no-such-host.invalid; in requests on macOS [Errno 8] nodename nor servname provided, or not known), while with proxy-side resolution the proxy reports it as reply 4. Proxy-side resolution also keeps DNS lookups off your own network, see socks5h and DNS leak.
Fix checklist
- Read the stage first. Greeting and login errors are configuration on your side; reply codes describe the proxy's attempt to reach the target.
- Credentials: a wrong password and a missing one give different errors (tables above). In curl, URL-encode them inside the proxy URL or pass them with
-U user:pass, which worked for SOCKS5 in our test. - Scheme and port: an "invalid version" or "invalid data" error means the port answered in another protocol. Check that the scheme in the URL matches what that port serves. ARC's gateway serves HTTP and SOCKS5 on the same port with the same credentials, so there the scheme decides.
- Reply 1 or 6: retry once on a new connection, then stop. Reply 2, 4 or 5: fix the hostname, port or destination; a retry gets the same answer.
- Browsers: Chrome reports reply codes only as
ERR_SOCKS_CONNECTION_FAILEDand cannot log in to SOCKS5, so use the HTTP form of the proxy there. - Then test the same string in the proxy tester, which accepts
socks5://andsocks5h://and names the failing step.
Code
Worked example
curl -sS -o /dev/null -w '%{http_code}\n' \ -x "socks5h://USERNAME_pool-arcfast_country-de:PASSWORD@proxy.arcproxies.io:8000" https://example.com/# Reproduced locally on 2026-11-14, curl 8.7.1:# working -> 200# wrong password -> curl: (97) User was rejected by the SOCKS5 server (1 1).# no credentials -> curl: (97) No authentication method was acceptable.# proxy-side failure -> curl: (97) Can't complete SOCKS5 connection to example.com. (1)# not a SOCKS5 port -> curl: (97) Received invalid version in initial SOCKS5 response.import reimport requestsPROXY = "socks5h://USERNAME_pool-arcfast_country-de:PASSWORD@proxy.arcproxies.io:8000" # pip install "requests[socks]"def socks_reply_code(err: Exception) -> int | None: """PySocks writes the RFC 1928 reply code first: '0x01: General SOCKS server failure'.""" m = re.search(r"0x0([1-8]): ", str(err)) return int(m.group(1)) if m else Nonetry: r = requests.get("https://example.com/", proxies={"http": PROXY, "https": PROXY}, timeout=30) print(r.status_code)except requests.exceptions.ConnectionError as err: # SOCKS failures are not ProxyError code = socks_reply_code(err) if code in (1, 6): print(f"reply {code}: failure at the proxy or a timeout; retry once, then stop") elif code is not None: print(f"reply {code}: check the target host and port; retrying will not help") else: print("handshake or authentication failed:", err)import axios from 'axios';import { SocksProxyAgent } from 'socks-proxy-agent';const agent = new SocksProxyAgent('socks5h://USERNAME_pool-arcfast_country-de:PASSWORD@proxy.arcproxies.io:8000');try { const res = await axios.get('https://example.com/', { httpAgent: agent, httpsAgent: agent, proxy: false, timeout: 30_000, }); console.log(res.status);} catch (err) { // "Socks5 proxy rejected connection - Failure" is reply 1, "Socks5 Authentication failed" a wrong password console.error(err.message);}FAQ
Questions
Something not covered? Write to contact@arcproxies.io.
What does curl: (97) Can't complete SOCKS5 connection mean?
The SOCKS5 proxy accepted your login but could not connect to the target. The number in parentheses at the end is the RFC 1928 reply code: 1 general failure, 2 not allowed by ruleset, 3 network unreachable, 4 host unreachable, 5 connection refused, 6 TTL expired, 7 command not supported, 8 address type not supported.
What is a General SOCKS server failure?
Reply code 1 in RFC 1928. The proxy reports that it could not complete the request without saying why. Retry once on a new connection; if it repeats, check the target host and port and test the same target through the HTTP form of the proxy.
What does SOCKS5 Host unreachable (reply 4) mean?
The proxy could not reach the target host. With socks5h:// the proxy also resolves the hostname, so a misspelled or non-existent hostname comes back as reply 4. Check the hostname before retrying.
Why does curl say No authentication method was acceptable?
The SOCKS5 proxy requires a username and password, and curl offered no login method because none was given. Add the credentials to the proxy URL or pass them with -U.
What does User was rejected by the SOCKS5 server (1 1) mean?
The proxy rejected the username or password. The numbers are the version and status bytes of the RFC 1929 login reply; any status other than 0 means failure. Copy the credentials again and URL-encode special characters.
Should I use socks5:// or socks5h://?
Use socks5h:// in curl and Python requests so the proxy resolves hostnames. httpx and aiohttp-socks already send the hostname with socks5://, and aiohttp-socks and Chrome reject the socks5h:// scheme.
Sources & review
Last reviewed by the ARC Proxies team. Prices are read from the live catalog at build time.
- [1]IETF: RFC 1928: SOCKS Protocol Version 5 (reply field, methods)
- [2]IETF: RFC 1929: Username/Password Authentication for SOCKS V5
- [3]curl: lib/socks.c at curl 8.7.1 (SOCKS5 error messages)
- [4]curl: libcurl error codes (5, 6, 7, 56, 97 CURLE_PROXY)
- [5]curl: CURLINFO_PROXY_ERROR (CURLPX_REPLY_* codes)
- [6]PySocks: socks.py (SOCKS5_ERRORS and handshake errors)
- [7]socks (npm): src/common/constants.ts (error messages and reply codes)
- [8]Requests: Advanced usage: Proxies and SOCKS (socks5 vs socks5h)
- [9]HTTPX: Proxies: SOCKS
- [10]aiohttp-socks: README: ProxyConnector, rdns
Next
Where to go from here
Guides