XTLS/Xray-core · error

shadowsocks 2022 (relay): all users must have relay address

Error message

shadowsocks 2022 (relay): all users must have relay address

What it means

Shadowsocks-2022 relay mode is selected when the first user has an address; every relay destination must then specify where to forward traffic. This error fires when any user lacks the 'address' field while building RelayDestinations.

Source

Thrown at infra/conf/shadowsocks.go:167

			}
			return nil
		}
		if err := task.ParallelForN(len(v.Users), processUser); err != nil {
			return nil, err
		}
		return config, nil
	}

	config := new(shadowsocks_2022.RelayServerConfig)
	config.Method = v.Cipher
	config.Key = v.Password
	config.Network = v.NetworkList.Build()
	for _, user := range v.Users {
		if user.Cipher != "" {
			return nil, errors.New("shadowsocks 2022 (relay): users must have empty method")
		}
		if user.Address == nil {
			return nil, errors.New("shadowsocks 2022 (relay): all users must have relay address")
		}
		config.Destinations = append(config.Destinations, &shadowsocks_2022.RelayDestination{
			Key:     user.Password,
			Email:   user.Email,
			Address: user.Address.Build(),
			Port:    uint32(user.Port),
		})
	}
	return config, nil
}

type ShadowsocksServerTarget struct {
	Address  *Address `json:"address"`
	Port     uint16   `json:"port"`
	Level    byte     `json:"level"`
	Email    string   `json:"email"`
	Cipher   string   `json:"method"`
	Password string   `json:"password"`

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Give every user an 'address' (and 'port') if you intend relay mode.
  2. If you wanted plain multi-user mode, remove 'address'/'port' from ALL users so users[0].Address is nil.
  3. Ensure all users uniformly follow one mode — mixing causes this and the sibling relay errors.

Example fix

// before
"users": [
  {"address": "a.example.com", "port": 8388, "password": "..."},
  {"password": "..."}
]

// after (relay: all have addresses)
"users": [
  {"address": "a.example.com", "port": 8388, "password": "..."},
  {"address": "b.example.com", "port": 8388, "password": "..."}
]
Defensive patterns

Strategy: validation

Validate before calling

func validRelayAddresses(users []User) bool {
    for _, u := range users {
        if u.Address == nil {
            return false
        }
    }
    return true
}

Prevention

When it happens

Trigger: A 2022 inbound with users where users[0] has 'address' set but a later user omits it — the config is treated as relay and the address-less destination is rejected.

Common situations: Mixed user lists where some entries are local users (no address) and some are relay destinations; YAML indentation dropping the address key; partial migration between multi-user and relay layouts.

Related errors


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