shadowsocks/shadowsocks-windows · error · ArgumentException
No server configured
Error message
No server configured
What it means
Thrown as ArgumentException from TCPRelay.CreateRemote when GetAServer returns null or a server whose `server` field is empty, meaning no usable upstream Shadowsocks server is available for the connection. This is a configuration/availability failure: the strategy and server list could not select a target. It fires before the encryptor is created.
Source
Thrown at shadowsocks-csharp/Controller/Service/TCPRelay.cs:264
// TODO: decouple controller
public TCPHandler(ShadowsocksController controller, Configuration config, Socket socket)
{
_controller = controller;
_config = config.proxy;
_connection = socket;
_proxyTimeout = config.proxy.proxyTimeout * 1000;
_serverTimeout = config.GetCurrentServer().timeout * 1000;
lastActivity = DateTime.Now;
}
public void CreateRemote()
{
Server server = _controller.GetAServer(IStrategyCallerType.TCP, (IPEndPoint)_connection.RemoteEndPoint,
_destEndPoint);
if (server == null || server.server == "")
{
throw new ArgumentException("No server configured");
}
_encryptor = EncryptorFactory.GetEncryptor(server.method, server.password);
_server = server;
/* prepare address buffer length for AEAD */
Logger.Trace($"_addrBufLength={_addrBufLength}");
_encryptor.AddrBufLength = _addrBufLength;
}
public void Start(byte[] firstPacket, int length)
{
_firstPacket = firstPacket;
_firstPacketLength = length;
HandshakeReceive();
}
View on GitHub (pinned to 891d971682)
Solutions
- Add at least one valid server in the configuration (address, port, method, password).
- If using a strategy, check that it has not disabled all servers; switch to a simpler strategy or reset server reachability.
- Validate gui-config.json for any server entries with an empty `server` field and fix or remove them.
- Ensure GetAServer's caller/endpoint logic can actually select from the configured list.
Example fix
// before
Server server = _controller.GetAServer(IStrategyCallerType.TCP, (IPEndPoint)_connection.RemoteEndPoint, _destEndPoint);
if (server == null || server.server == "")
throw new ArgumentException("No server configured");
// after: keep the connection open with a clearer message and a guard upstream
if (server == null || string.IsNullOrWhiteSpace(server.server))
throw new ArgumentException("No server configured (add a server or check HA strategy state)"); Defensive patterns
Strategy: validation
Validate before calling
// Ensure a usable server exists before relaying
if (_controller.GetCurrentServer() is null || string.IsNullOrWhiteSpace(_controller.GetCurrentServer()?.server))
return; // drop the connection cleanly instead of throwing Type guard
bool HasUsableServer(Configuration c) =>
c.configs != null && c.configs.Any(s => !string.IsNullOrWhiteSpace(s?.server)); Try / catch
try { relay.CreateRemote(); }
catch (ArgumentException ex) when (ex.Message == "No server configured")
{ /* close the connection, notify UI to add a server */ } Prevention
- Validate config has at least one non-empty server at load time.
- Show a clear UI state when no server is selectable rather than throwing per-connection.
- Reset HA-strategy disabled flags when servers are edited.
When it happens
Trigger: The server list is empty or every server was filtered out by the active strategy (e.g. all marked unreachable by a high-availability strategy); the selected server has a blank address field due to a malformed config; GetAServer returned null because no server matched the caller/endpoint criteria.
Common situations: Fresh install with no servers added; user deleted all servers; HA strategy disabled all servers after repeated failures; a manually edited gui-config.json left a server with an empty address.
Related errors
- Server IP can not be blank
- {callbackName} not found
- Unknown forward proxy.
- method not found
- failed to set key
AI-assisted analysis of shadowsocks/shadowsocks-windows@891d971682 (2026-08-13).
Data as JSON: /api/errors/3096a3dac78cd2e2.
Report an issue: GitHub.