shadowsocks/shadowsocks-windows · warning · ArgumentException

Timeout is invalid, it should not exceed {0}

Error message

Timeout is invalid, it should not exceed {0}

What it means

ArgumentException thrown by CheckTimeout when timeout <= 0 or timeout > maxTimeout. The timeout governs socket I/O idle limits; an invalid value either disables timeouts (<=0) or exceeds the configured ceiling (maxTimeout). The {0} placeholder is filled with maxTimeout at throw time via I18N.GetString.

Source

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

                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(
                    I18N.GetString("Timeout is invalid, it should not exceed {0}", maxTimeout));
        }
    }
}

View on GitHub (pinned to 891d971682)

Solutions

  1. Set the timeout to a positive value within maxTimeout (commonly a few hundred seconds).
  2. If a larger timeout is required, confirm maxTimeout allows it or raise the cap in your build.
  3. Use the GUI spinner which clamps the input to the valid range.

Example fix

// before
Configuration.CheckTimeout(0, maxTimeout: 600);

// after
Configuration.CheckTimeout(120, maxTimeout: 600);
Defensive patterns

Strategy: validation

Validate before calling

if (timeout <= 0 || timeout > maxTimeout) {
    // surface error in UI before calling CheckTimeout
    return;
}

Try / catch

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

Prevention

When it happens

Trigger: Config timeout set to 0 or a negative value. Timeout larger than the maxTimeout passed in (often derived from the cipher's safe range). A hand-edited gui-config.json with an out-of-range timeout.

Common situations: Copying a server config that set a very large timeout. Resetting the timeout to 0 by accident. A build where maxTimeout was lowered but old configs exceed it.

Understand the failure class

Related errors


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