{"record":{"id":"2a25063cd3d12d6d","repo":"XTLS/Xray-core","slug":"shadowsocks-2022-relay-all-users-must-have-rela","errorCode":null,"errorMessage":"shadowsocks 2022 (relay): all users must have relay address","messagePattern":"shadowsocks 2022 \\(relay\\): all users must have relay address","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/shadowsocks.go","lineNumber":167,"sourceCode":"\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\tif err := task.ParallelForN(len(v.Users), processUser); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn config, nil\n\t}\n\n\tconfig := new(shadowsocks_2022.RelayServerConfig)\n\tconfig.Method = v.Cipher\n\tconfig.Key = v.Password\n\tconfig.Network = v.NetworkList.Build()\n\tfor _, user := range v.Users {\n\t\tif user.Cipher != \"\" {\n\t\t\treturn nil, errors.New(\"shadowsocks 2022 (relay): users must have empty method\")\n\t\t}\n\t\tif user.Address == nil {\n\t\t\treturn nil, errors.New(\"shadowsocks 2022 (relay): all users must have relay address\")\n\t\t}\n\t\tconfig.Destinations = append(config.Destinations, &shadowsocks_2022.RelayDestination{\n\t\t\tKey:     user.Password,\n\t\t\tEmail:   user.Email,\n\t\t\tAddress: user.Address.Build(),\n\t\t\tPort:    uint32(user.Port),\n\t\t})\n\t}\n\treturn config, nil\n}\n\ntype ShadowsocksServerTarget struct {\n\tAddress  *Address `json:\"address\"`\n\tPort     uint16   `json:\"port\"`\n\tLevel    byte     `json:\"level\"`\n\tEmail    string   `json:\"email\"`\n\tCipher   string   `json:\"method\"`\n\tPassword string   `json:\"password\"`","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/shadowsocks.go#L149-L185","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Give every user an 'address' (and 'port') if you intend relay mode.","If you wanted plain multi-user mode, remove 'address'/'port' from ALL users so users[0].Address is nil.","Ensure all users uniformly follow one mode — mixing causes this and the sibling relay errors."],"exampleFix":"// before\n\"users\": [\n  {\"address\": \"a.example.com\", \"port\": 8388, \"password\": \"...\"},\n  {\"password\": \"...\"}\n]\n\n// after (relay: all have addresses)\n\"users\": [\n  {\"address\": \"a.example.com\", \"port\": 8388, \"password\": \"...\"},\n  {\"address\": \"b.example.com\", \"port\": 8388, \"password\": \"...\"}\n]","handlingStrategy":"validation","validationCode":"func validRelayAddresses(users []User) bool {\n    for _, u := range users {\n        if u.Address == nil {\n            return false\n        }\n    }\n    return true\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one mode (multi-user vs relay) per inbound and keep user entries uniform"],"tags":["shadowsocks-2022","relay","address","config"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}