{"record":{"id":"757f3d89b1f1c908","repo":"shadowsocks/shadowsocks-windows","slug":"port-can-t-be-8123","errorCode":null,"errorMessage":"Port can't be 8123","messagePattern":"Port can't be 8123","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"warning","filePath":"shadowsocks-csharp/Model/Configuration.cs","lineNumber":362,"sourceCode":"            return server;\r\n        }\r\n\r\n        public static Server GetDefaultServer()\r\n        {\r\n            return new Server();\r\n        }\r\n\r\n        public static void CheckPort(int port)\r\n        {\r\n            if (port <= 0 || port > 65535)\r\n                throw new ArgumentException(I18N.GetString(\"Port out of range\"));\r\n        }\r\n\r\n        public static void CheckLocalPort(int port)\r\n        {\r\n            CheckPort(port);\r\n            if (port == 8123)\r\n                throw new ArgumentException(I18N.GetString(\"Port can't be 8123\"));\r\n        }\r\n\r\n        private static void CheckPassword(string password)\r\n        {\r\n            if (string.IsNullOrEmpty(password))\r\n                throw new ArgumentException(I18N.GetString(\"Password can not be blank\"));\r\n        }\r\n\r\n        public static void CheckServer(string server)\r\n        {\r\n            if (string.IsNullOrEmpty(server))\r\n                throw new ArgumentException(I18N.GetString(\"Server IP can not be blank\"));\r\n        }\r\n\r\n        public static void CheckTimeout(int timeout, int maxTimeout)\r\n        {\r\n            if (timeout <= 0 || timeout > maxTimeout)\r\n                throw new ArgumentException(\r","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/shadowsocks/shadowsocks-windows/blob/891d971682eefcaa2e640258d3b352a3ad3b2233/shadowsocks-csharp/Model/Configuration.cs#L344-L380","documentation":"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.","triggerScenarios":"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.","commonSituations":"Choosing 8123 because it appears free. Migrating from an older setup that reused the HTTP proxy port as the SOCKS port.","solutions":["Pick a different local port for the SOCKS listener (e.g. 1080, 1086, 7890).","If 8123 is genuinely desired, change the internal HTTP proxy port instead so the two do not clash."],"exampleFix":"// before\nConfiguration.CheckLocalPort(8123); // reserved\n\n// after\nConfiguration.CheckLocalPort(1080);","handlingStrategy":"validation","validationCode":"static bool IsValidLocalPort(int p) => p > 0 && p <= 65535 && p != 8123;\nif (!IsValidLocalPort(port)) return; // surface error in UI","typeGuard":null,"tryCatchPattern":"try { Configuration.CheckLocalPort(port); }\ncatch (ArgumentException ex) { /* show ex.Message, keep the dialog open */ }","preventionTips":["Avoid 8123 for the local listener; it is reserved for the HTTP proxy.","Document reserved ports in the GUI tooltip."],"tags":["configuration","validation","port","networking","reserved-port"],"backgroundTag":null,"analyzedSha":"891d971682eefcaa2e640258d3b352a3ad3b2233","analyzedAt":"2026-08-13T10:12:34.434Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}