shadowsocks/shadowsocks-windows · warning · ArgumentException

Port can't be 8123

Error message

Port can't be 8123

What it means

ArgumentException thrown by CheckLocalPort when the local listener port is exactly 8123. Port 8123 is reserved by Shadowsocks for its internal HTTP proxy forwarding (privoxy/polipo), so binding the local SOCKS listener there would collide. CheckLocalPort runs CheckPort first, then rejects 8123.

Source

Thrown at shadowsocks-csharp/Model/Configuration.cs:362

            return server;
        }

        public static Server GetDefaultServer()
        {
            return new Server();
        }

        public static void CheckPort(int port)
        {
            if (port <= 0 || port > 65535)
                throw new ArgumentException(I18N.GetString("Port out of range"));
        }

        public static void CheckLocalPort(int port)
        {
            CheckPort(port);
            if (port == 8123)
                throw new ArgumentException(I18N.GetString("Port can't be 8123"));
        }

        private static void CheckPassword(string password)
        {
            if (string.IsNullOrEmpty(password))
                throw new ArgumentException(I18N.GetString("Password can not be blank"));
        }

        public static void CheckServer(string server)
        {
            if (string.IsNullOrEmpty(server))
                throw new ArgumentException(I18N.GetString("Server IP can not be blank"));
        }

        public static void CheckTimeout(int timeout, int maxTimeout)
        {
            if (timeout <= 0 || timeout > maxTimeout)
                throw new ArgumentException(

View on GitHub (pinned to 891d971682)

Solutions

  1. Pick a different local port for the SOCKS listener (e.g. 1080, 1086, 7890).
  2. If 8123 is genuinely desired, change the internal HTTP proxy port instead so the two do not clash.

Example fix

// before
Configuration.CheckLocalPort(8123); // reserved

// after
Configuration.CheckLocalPort(1080);
Defensive patterns

Strategy: validation

Validate before calling

static bool IsValidLocalPort(int p) => p > 0 && p <= 65535 && p != 8123;
if (!IsValidLocalPort(port)) return; // surface error in UI

Try / catch

try { Configuration.CheckLocalPort(port); }
catch (ArgumentException ex) { /* show ex.Message, keep the dialog open */ }

Prevention

When it happens

Trigger: The user sets the local port to 8123 in settings. An imported or pasted config specifies localPort 8123. A config migration copied the HTTP-proxy port into the SOCKS-port field.

Common situations: Choosing 8123 because it appears free. Migrating from an older setup that reused the HTTP proxy port as the SOCKS port.

Related errors


AI-assisted analysis of shadowsocks/shadowsocks-windows@891d971682 (2026-08-13). Data as JSON: /api/errors/757f3d89b1f1c908. Report an issue: GitHub.