{"record":{"id":"a8529b918e227974","repo":"XTLS/Xray-core","slug":"shadowsocks-2022-multi-user-missing-server-meth","errorCode":null,"errorMessage":"shadowsocks 2022 (multi-user): missing server method","messagePattern":"shadowsocks 2022 \\(multi-user\\): missing server method","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/shadowsocks.go","lineNumber":124,"sourceCode":"\t\t\tAccount: serial.ToTypedMessage(account),\n\t\t})\n\t}\n\n\treturn config, nil\n}\n\nfunc buildShadowsocks2022(v *ShadowsocksServerConfig) (proto.Message, error) {\n\tif len(v.Users) == 0 {\n\t\tconfig := new(shadowsocks_2022.ServerConfig)\n\t\tconfig.Method = v.Cipher\n\t\tconfig.Key = v.Password\n\t\tconfig.Network = v.NetworkList.Build()\n\t\tconfig.Email = v.Email\n\t\treturn config, nil\n\t}\n\n\tif v.Cipher == \"\" {\n\t\treturn nil, errors.New(\"shadowsocks 2022 (multi-user): missing server method\")\n\t}\n\tif !strings.Contains(v.Cipher, \"aes\") {\n\t\treturn nil, errors.New(\"shadowsocks 2022 (multi-user): only blake3-aes-*-gcm methods are supported\")\n\t}\n\n\tif v.Users[0].Address == nil {\n\t\tconfig := new(shadowsocks_2022.MultiUserServerConfig)\n\t\tconfig.Method = v.Cipher\n\t\tconfig.Key = v.Password\n\t\tconfig.Network = v.NetworkList.Build()\n\n\t\tconfig.Users = make([]*protocol.User, len(v.Users))\n\t\tprocessUser := func(idx int) error {\n\t\t\tuser := v.Users[idx]\n\t\t\tif user.Cipher != \"\" {\n\t\t\t\treturn errors.New(\"shadowsocks 2022 (multi-user): users must have empty method\")\n\t\t\t}\n\t\t\taccount := &shadowsocks_2022.Account{","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/shadowsocks.go#L106-L142","documentation":"buildShadowsocks2022 handles the Shadowsocks-2022 server. When a 'users' array is present (multi-user or relay mode), the server-level cipher/method must be set explicitly because per-user methods are forbidden in 2022. An empty v.Cipher with non-empty users triggers this error.","triggerScenarios":"An inbound with 'users' defined but the top-level 'method'/'cipher' field omitted or empty, e.g. settings {\"password\": \"...\", \"users\": [...]} with no method.","commonSituations":"Assuming the 2022 method can be inferred from key length; converting a single-user 2022 config to multi-user and deleting the method field; tutorial configs that only show the single-user form.","solutions":["Set the server-level method to a 2022 AES method, e.g. \"2022-blake3-aes-128-gcm\" or \"2022-blake3-aes-256-gcm\".","Match the key length to the method: 16-byte base64 key for aes-128, 32-byte for aes-256.","Keep per-user 'method' empty — only the server-level method is allowed in multi-user mode."],"exampleFix":"// before\n\"settings\": {\"password\": \"...\", \"users\": [{\"password\": \"...\"}]}\n\n// after\n\"settings\": {\"method\": \"2022-blake3-aes-128-gcm\", \"password\": \"<16B-b64>\", \"users\": [{\"password\": \"<16B-b64>\", \"email\": \"u1\"}]}","handlingStrategy":"validation","validationCode":"func validSS2022MultiUser(method string, users []User) bool {\n    return len(users) == 0 || method != \"\"\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always emit the server-level method when generating multi-user 2022 configs"],"tags":["shadowsocks-2022","config","inbound","multi-user"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}