XTLS/Xray-core · error

"maxClientVer[", i, "]" should be less than 256

Error message

"maxClientVer[", i, "]" should be less than 256

What it means

Thrown by the REALITY builder when a component of maxClientVer fails ParseUint with bitSize 8 — the number is negative, non-numeric, or >= 256. Components map to single bytes in a 3-byte version vector.

Source

Thrown at infra/conf/transport_security.go:129

					return nil, errors.New(`"minClientVer[`, i, `]" should be less than 256`)
				} else {
					config.MinClientVer[i] = byte(u)
				}
			}
			errors.LogWarning(context.Background(), `REALITY: Changing "minClientVer" will increase the likelihood of your server's IP being blocked by the GFW`)
		} else {
			config.MinClientVer = []byte{26, 3, 27} // change it at your own risk: https://github.com/XTLS/Xray-core/commit/af7eb68028732a8ee3c0e5d6ab2b8a657bb2e770
			errors.LogWarning(context.Background(), `REALITY: The default minimal client version is Xray-core v26.3.27, other clients may be refused to connect`)
		}
		if c.MaxClientVer != "" {
			config.MaxClientVer = make([]byte, 3)
			var u uint64
			for i, s := range strings.Split(c.MaxClientVer, ".") {
				if i == 3 {
					return nil, errors.New(`invalid "maxClientVer": `, c.MaxClientVer)
				}
				if u, err = strconv.ParseUint(s, 10, 8); err != nil {
					return nil, errors.New(`"maxClientVer[`, i, `]" should be less than 256`)
				} else {
					config.MaxClientVer[i] = byte(u)
				}
			}
		}
		if len(c.ShortIds) == 0 {
			return nil, errors.New(`empty "shortIds"`)
		}
		config.ShortIds = make([][]byte, len(c.ShortIds))
		for i, s := range c.ShortIds {
			if len(s) > 16 {
				return nil, errors.New(`too long "shortIds[`, i, `]": `, s)
			}
			config.ShortIds[i] = make([]byte, 8)
			if _, err = hex.Decode(config.ShortIds[i], []byte(s)); err != nil {
				return nil, errors.New(`invalid "shortIds[`, i, `]": `, s)
			}
		}

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Keep every component numeric and within 0-255.
  2. Omit maxClientVer if you do not need an upper bound.

Example fix

// before
"maxClientVer": "1.8.256"
// after
"maxClientVer": "1.8.24"
Defensive patterns

Strategy: validation

Validate before calling

for i, p := range strings.Split(c.MaxClientVer, ".") {
    if _, err := strconv.ParseUint(p, 10, 8); err != nil {
        return fmt.Errorf("maxClientVer component %d (%q) invalid or >= 256", i, p)
    }
}

Prevention

When it happens

Trigger: Setting "maxClientVer": "1.8.256" or "1.8.x".

Common situations: Typos and placeholder strings left in from templates.

Related errors


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/e12767d75792cc92. Report an issue: GitHub.