{"record":{"id":"896a584f452db574","repo":"XTLS/Xray-core","slug":"auth-method-not-supported","errorCode":null,"errorMessage":"auth method not supported.","messagePattern":"auth method not supported\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"proxy/socks/protocol.go","lineNumber":464,"sourceCode":"\n\tb := buf.New()\n\tdefer b.Release()\n\n\tcommon.Must2(b.Write([]byte{socks5Version, 0x01, authByte}))\n\tif err := buf.WriteAllBytes(writer, b.Bytes(), nil); err != nil {\n\t\treturn nil, err\n\t}\n\n\tb.Clear()\n\tif _, err := b.ReadFullFrom(reader, 2); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif b.Byte(0) != socks5Version {\n\t\treturn nil, errors.New(\"unexpected server version: \", b.Byte(0)).AtWarning()\n\t}\n\tif b.Byte(1) != authByte {\n\t\treturn nil, errors.New(\"auth method not supported.\").AtWarning()\n\t}\n\n\tif authByte == authPassword {\n\t\tb.Clear()\n\t\taccount := request.User.Account.(*Account)\n\t\tcommon.Must(b.WriteByte(0x01))\n\t\tcommon.Must(b.WriteByte(byte(len(account.Username))))\n\t\tcommon.Must2(b.WriteString(account.Username))\n\t\tcommon.Must(b.WriteByte(byte(len(account.Password))))\n\t\tcommon.Must2(b.WriteString(account.Password))\n\t\tif err := buf.WriteAllBytes(writer, b.Bytes(), nil); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tb.Clear()\n\t\tif _, err := b.ReadFullFrom(reader, 2); err != nil {\n\t\t\treturn nil, err\n\t\t}","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/socks/protocol.go#L446-L482","documentation":"Thrown during the SOCKS5 client handshake when the server's selected auth method byte differs from the one Xray offered. If Xray offered 0x02 (username/password, because credentials are configured) and the server picks 0x00 or 0xFF, the methods are incompatible and the handshake aborts. Marked AtWarning.","triggerScenarios":"Xray outbound 'socks' has auth configured but the remote SOCKS5 server requires no auth or doesn't support username/password auth (or vice versa: no auth configured client-side while the server demands 0x02); server replies 0xFF 'no acceptable methods'.","commonSituations":"Server upgraded and its auth requirement changed; credentials omitted from the Xray outbound settings while the server enforces auth; mixed config where users array exists server-side but the client sends none.","solutions":["Match the client to the server: either add username/password to the Xray outbound servers entry, or disable auth on the SOCKS5 server.","Confirm the remote server actually supports username/password auth (RFC 1929) if credentials are configured.","Test the pair with curl --socks5 host:port -U user:pass to isolate which side mismatches.","Check for middleboxes stripping the method negotiation."],"exampleFix":"// before: outbound without credentials against an auth-requiring server\n{ \"protocol\": \"socks\", \"settings\": { \"servers\": [ { \"address\": \"s.example\", \"port\": 1080 } ] } }\n\n// after\n{ \"protocol\": \"socks\", \"settings\": { \"servers\": [ { \"address\": \"s.example\", \"port\": 1080, \"users\": [ { \"user\": \"u\", \"pass\": \"p\" } ] } ] } }","handlingStrategy":"validation","validationCode":"// probe supported auth methods during a preflight handshake\nconn.Write([]byte{0x05, 0x02, 0x00}) // offer no-auth + userpass\nreply := make([]byte, 2)\nio.ReadFull(conn, reply)\nif reply[1] == 0xFF {\n\treturn errors.New(\"server accepts none of our auth methods\")\n}","typeGuard":null,"tryCatchPattern":"if err := client.Process(ctx, link, dialer); err != nil {\n\tif strings.Contains(err.Error(), \"auth method not supported\") {\n\t\t// align credentials presence with server requirements\n\t}\n}","preventionTips":["Keep client credentials presence in sync with server auth mode.","Document the auth mode next to each server entry in config.","Use preflight probes in connection managers that hot-switch outbounds."],"tags":["socks","socks5","authentication","handshake","config"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}