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.

6 min read
A SOCKS5 connection in three exchanges: the greeting and the login succeed, then the proxy answers the CONNECT request with reply code 0x01, general SOCKS server failure.The login passed. The connection to the site did not.1. Greetingmethods: username/password2. Loginstatus 0x00: accepted3. CONNECT host:443REP 0x01: general failure0x01: General SOCKS server failureReply codes from RFC 1928, section 6

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.

REP 0x01same login on :9000

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.

ExchangeWhat is decidedIf it fails
1. GreetingWhich login method to useAll offered SOCKS5 authentication methods were rejected
2. Username and passwordWhether the login is validSOCKS5 authentication failed
3. CONNECT host:portWhether the proxy opens the connection0x01: General SOCKS server failure
Fig. 1 — The SOCKS5 exchanges and which failure each one can report. Message names from PySocks and curl's source.
ClientWhat you see
Python requests with PySocksConnectionError: SOCKSHTTPSConnectionPool(host=…) … 0x01: General SOCKS server failure
PySocks directlysocks.SOCKS5Error: 0x01: General SOCKS server failure
curlcurl: (97) cannot complete SOCKS5 connection to HOST. (1)
libcurlCURLE_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.

0x01socks5h://…:11000 restricted targetSOCKS5 can’t say why
464http://…:9000 same target, same loginrestricted on the network
465http://…:9000 filters with no exitdrop a filter
200http://…:9000 another sitelogin and gateway fine

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.

CodeRFC 1928PySocks messagecurl (CURLINFO_PROXY_ERROR)
0x01general SOCKS server failureGeneral SOCKS server failureCURLPX_REPLY_GENERAL_SERVER_FAILURE
0x02connection not allowed by rulesetConnection not allowed by rulesetCURLPX_REPLY_NOT_ALLOWED
0x03Network unreachableNetwork unreachableCURLPX_REPLY_NETWORK_UNREACHABLE
0x04Host unreachableHost unreachableCURLPX_REPLY_HOST_UNREACHABLE
0x05Connection refusedConnection refusedCURLPX_REPLY_CONNECTION_REFUSED
0x06TTL expiredTTL expiredCURLPX_REPLY_TTL_EXPIRED
0x07Command not supportedCommand not supported, or protocol errorCURLPX_REPLY_COMMAND_NOT_SUPPORTED
0x08Address type not supportedAddress type not supportedCURLPX_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. 1.Check the hostname

    Open the URL without a proxy, or run nslookup on the host. A name that doesn’t resolve fails the same way through every SOCKS5 proxy.

  2. 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/json

    CONNECT tunnel failed, response 465 means no exit for the filters, 464 a restricted target. Every status curl can print here is in the curl tunnel error guide.

  3. 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. 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.

socks_reason.py
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?
It is reply code 1 of the SOCKS5 protocol (RFC 1928): the proxy accepted your connection and your login, but could not or would not open the connection to the site you asked for. It is a catch-all, so the reason has to be found elsewhere.
Is General SOCKS server failure a wrong password?
No. A SOCKS5 login is checked before the connect request, and a rejected login has its own message: 'SOCKS5 authentication failed' in Python (PySocks), 'User was rejected by the SOCKS5 server' in curl. If you see 0x01, the login got through.
Why do only some sites fail with General SOCKS server failure?
On our gateway that pattern means the network restricts those targets in every country, for example Microsoft's sign-in pages login.live.com and login.microsoftonline.com. Over HTTP the same request gets status 464. A new proxy line or other targeting doesn't change it; other sites keep working.
How do I find out why the SOCKS5 proxy failed?
Send the same request with the same login through the HTTP port (via.proxies.vision:9000). HTTP has status codes: 464 means the target is restricted, 465 that no exit matches your filters, 407 a wrong login, 403 a value in the username the gateway can't read.
Does socks5h cause General SOCKS server failure?
With socks5h:// the proxy looks up the hostname, so a hostname that doesn't exist comes back as 0x01 from the proxy. With socks5:// your own machine looks it up first and fails with a DNS error instead. Check the hostname for typos before anything else.

Residential proxies, pay per GB

HTTP and SOCKS5. Country, city and sticky sessions in the username. No subscription.