General SOCKS server failure (0x01)
The SOCKS5 proxy let you in and then couldn't reach the site. The code says almost nothing about why; the same login over HTTP does.
In short
0x01: General SOCKS server failure is the SOCKS5 proxy saying it could not open the connection you asked for. Your login was accepted; the target was not reached. Check the hostname, then send the same request through the HTTP port, which answers with a status code that names the reason.
A SOCKS5 connection is three short exchanges. The client greets the proxy and offers login methods. If the proxy picks username and password, the client sends them and the proxy answers yes or no. Only then does the client send the request that matters: connect me to this host and port.
The proxy answers that request with one byte, the reply field. 0x00 means the connection to the site is open and data can flow. Anything else is a failure, and RFC 1928 names eight of them. 0x01, general SOCKS server failure, is the one without a specific meaning: the proxy tried, or decided not to try, and gives no detail. The RFC also says the proxy must close the connection shortly after a failure reply, so there is nothing more to read.
Two things follow. A wrong password never produces 0x01: login failures are reported in the second exchange, with their own message. And the proxy itself was reachable, so firewalls and wrong ports are out too. What is left is the target: its name, whether the proxy can find an exit for it, and whether the proxy is willing to connect to it.
| Exchange | What is decided | If it fails |
|---|---|---|
| 1. Greeting | Which login method to use | All offered SOCKS5 authentication methods were rejected |
| 2. Username and password | Whether the login is valid | SOCKS5 authentication failed |
| 3. CONNECT host:port | Whether the proxy opens the connection | 0x01: General SOCKS server failure |
| Client | What you see |
|---|---|
| Python requests with PySocks | ConnectionError: SOCKSHTTPSConnectionPool(host=…) … 0x01: General SOCKS server failure |
| PySocks directly | socks.SOCKS5Error: 0x01: General SOCKS server failure |
| curl | curl: (97) cannot complete SOCKS5 connection to HOST. (1) |
| libcurl | CURLE_PROXY, with CURLINFO_PROXY_ERROR = CURLPX_REPLY_GENERAL_SERVER_FAILURE |
PySocks formats the reply byte as 0x01 and adds the name; curl prints the number in brackets. Exit code 97 is CURLE_PROXY, a proxy handshake error. Older curl releases word the message slightly differently.
The requests message is long, but the part after the last colon is the one that counts. If yours ends in SOCKS5 authentication failed instead, it is the login, and the SOCKS article for requests has every other message we reproduced.
What causes General SOCKS server failure?
The three causes on a residential gateway, from the most common to the rarest.
The hostname doesn’t resolve
With socks5h:// the proxy looks up the site’s name. A typo, a host that no longer exists or an internal name only your network knows comes back as 0x01 from the proxy. With socks5:// your machine does the lookup and you get a DNS error before the proxy is involved. Our tests for requests and PySocks showed exactly this split.
No exit matches your targeting
On a residential gateway the username carries filters: country, city, network. When no exit matches all of them at that moment, the SOCKS5 port can only say 0x01. Over HTTP the same login gets 465. Drop the narrowest filter, usually the city, and try again.
The target is restricted on the network
Some targets are blocked by the network in every country. On our gateway that includes Microsoft’s sign-in pages, login.live.com and login.microsoftonline.com, while other sites work. Over HTTP the answer is 464. No new proxy line, country or session changes it, and we don’t offer a way around it. The restricted sites page lists what we know.
What do the other SOCKS5 reply codes mean?
The reply byte after CONNECT, as RFC 1928 defines it and as PySocks and curl name it.
| Code | RFC 1928 | PySocks message | curl (CURLINFO_PROXY_ERROR) |
|---|---|---|---|
| 0x01 | general SOCKS server failure | General SOCKS server failure | CURLPX_REPLY_GENERAL_SERVER_FAILURE |
| 0x02 | connection not allowed by ruleset | Connection not allowed by ruleset | CURLPX_REPLY_NOT_ALLOWED |
| 0x03 | Network unreachable | Network unreachable | CURLPX_REPLY_NETWORK_UNREACHABLE |
| 0x04 | Host unreachable | Host unreachable | CURLPX_REPLY_HOST_UNREACHABLE |
| 0x05 | Connection refused | Connection refused | CURLPX_REPLY_CONNECTION_REFUSED |
| 0x06 | TTL expired | TTL expired | CURLPX_REPLY_TTL_EXPIRED |
| 0x07 | Command not supported | Command not supported, or protocol error | CURLPX_REPLY_COMMAND_NOT_SUPPORTED |
| 0x08 | Address type not supported | Address type not supported | CURLPX_REPLY_ADDRESS_TYPE_NOT_SUPPORTED |
Sources: RFC 1928, section 6, PySocks, CURLINFO_PROXY_ERROR. Which code a proxy picks for which problem is up to the proxy; many use 0x01 for most failures.
1.Check the hostname
Open the URL without a proxy, or run
nslookupon the host. A name that doesn’t resolve fails the same way through every SOCKS5 proxy.2.Ask the HTTP port for the reason
Same login, same target, HTTP instead of SOCKS5. curl prints the gateway’s status:
bash curl -x http://via.proxies.vision:9000 -U "USER-country-us:PASS" https://ipinfo.io/jsonCONNECT tunnel failed, response 465means no exit for the filters,464a restricted target. Every status curl can print here is in the curl tunnel error guide.3.Loosen the targeting on 465
Remove the city first, then the network (
-asn-). The ASN targeting guide shows which country and network pairs belong together.4.Accept a restricted target on 464
It applies in every country and to every proxy line, so retrying with other settings only spends bandwidth. Use another route for that site; everything else keeps working through the gateway.
A setup that finds the reason
Python with requests: try SOCKS5, and on failure ask the HTTP port with the same login. PROXY_USER and PROXY_PASS come from the environment.
import os
import re
import requests # pip install "requests[socks]"
USER = os.environ["PROXY_USER"] + "-country-us" # your targeting goes here
PASS = os.environ["PROXY_PASS"]
URL = "https://ipinfo.io/json" # the site that fails
def fetch(proxy):
return requests.get(URL, proxies={"http": proxy, "https": proxy}, timeout=30)
try:
# socks5h: the proxy resolves the hostname. Port 11000 rotates, 12000 is sticky.
r = fetch(f"socks5h://{USER}:{PASS}@via.proxies.vision:11000")
print("SOCKS5:", r.status_code)
except requests.exceptions.ConnectionError as e:
print("SOCKS5 failed:", "0x01" if "0x01" in str(e) else e)
# SOCKS5 has one code for many reasons. The HTTP port names the reason.
try:
r = fetch(f"http://{USER}:{PASS}@via.proxies.vision:9000")
print("HTTP:", r.status_code)
except requests.exceptions.ProxyError as e2:
code = re.search(r"failed: (\d{3})", str(e2)) # 464 restricted, 465 no exit
print("HTTP proxy answered:", code.group(1) if code else e2)Host, ports and login are the ones in your dashboard under Residential proxies. Targeting goes into the username: -country-us, -city-chicago, -asn-7922, and for one IP over time -session-job1-lifetime-10 on port 12000. For plain web requests, the HTTP port is the simpler choice anyway: no extra package, and a status code for every failure.
What does 0x01: General SOCKS server failure mean?
Is General SOCKS server failure a wrong password?
Why do only some sites fail with General SOCKS server failure?
How do I find out why the SOCKS5 proxy failed?
Does socks5h cause General SOCKS server failure?
Keep reading
Proxy Password With Special Characters (@ : # %)
A proxy password with @, :, # or % breaks the proxy URL. What curl, requests, httpx, Node and Go say, which encoding fixes it, and three traps we found.
6 min read · #authentication#errors
aiohttp Proxy Errors: ClientHttpProxyError 407, SOCKS5 and trust_env
aiohttp's ClientHttpProxyError explained, why its message leaks your proxy password, socks5:// without aiohttp-socks, and rotation.
6 min read · #python#errors
curl: (56) CONNECT tunnel failed, response 407 (Received HTTP code 407 from proxy)
curl (56) 'CONNECT tunnel failed, response 407', or 'Received HTTP code 407 from proxy after CONNECT' in older curl: the cause, the fix, every exit code.
6 min read · #errors#authentication
Residential proxies, pay per GB
HTTP and SOCKS5. Country, city and sticky sessions in the username. No subscription.