{"record":{"id":"6f30b421505915a3","repo":"XTLS/Xray-core","slug":"failed-to-initiate-user","errorCode":null,"errorMessage":"failed to initiate user","messagePattern":"failed to initiate user","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/vless/inbound/inbound.go","lineNumber":67,"sourceCode":"\tcommon.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {\n\t\tvar dc dns.Client\n\t\tif err := core.RequireFeatures(ctx, func(d dns.Client) error {\n\t\t\tdc = d\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tc := config.(*Config)\n\n\t\tvalidator := new(vless.MemoryValidator)\n\t\tfor _, user := range c.Users {\n\t\t\tu, err := user.ToMemoryUser()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.New(\"failed to get VLESS user\").Base(err).AtError()\n\t\t\t}\n\t\t\tif err := validator.Add(u); err != nil {\n\t\t\t\treturn nil, errors.New(\"failed to initiate user\").Base(err).AtError()\n\t\t\t}\n\t\t}\n\n\t\treturn New(ctx, c, dc, validator)\n\t}))\n}\n\n// Handler is an inbound connection handler that handles messages in VLess protocol.\ntype Handler struct {\n\tinboundHandlerManager  feature_inbound.Manager\n\tpolicyManager          policy.Manager\n\tstats                  stats.Manager\n\tvalidator              vless.Validator\n\tdecryption             *encryption.ServerInstance\n\toutboundHandlerManager outbound.Manager\n\tobserver               features.Feature\n\tdefaultDispatcher      routing.Dispatcher\n\tctx                    context.Context","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/vless/inbound/inbound.go#L49-L85","documentation":"Thrown during VLESS inbound handler creation when MemoryValidator.Add(u) rejects a user that already passed ToMemoryUser(). The validator indexes users by UUID (and email), so this fires on duplicate registration inside one inbound — the second Add with the same key fails.","triggerScenarios":"Two clients[] entries in the same VLESS inbound share the same \"id\" (UUID), or the same email is reused in a way the validator rejects; occurs at startup while the handler builds its user table.","commonSituations":"Copying a client block to add a new user and forgetting to change the id; merging inbound configs that each contained the same default UUID; automated provisioning scripts that assign a fixed UUID.","solutions":["Look at the wrapped validator error to see which key (id/email) collided","Give every clients[] entry in the same inbound a distinct UUID and distinct email","If the same user must appear in two inbounds, that is allowed — only duplicates within one inbound are rejected","Regenerate ids with `xray uuid` per client"],"exampleFix":"// before — duplicate id in one inbound\n\"clients\": [\n  { \"id\": \"b831381d-...-8ba05a7\", \"email\": \"a\" },\n  { \"id\": \"b831381d-...-8ba05a7\", \"email\": \"b\" }\n]\n\n// after — unique ids\n\"clients\": [\n  { \"id\": \"b831381d-...-8ba05a7\", \"email\": \"a\" },\n  { \"id\": \"f67e1a20-...-c4d9e6f\", \"email\": \"b\" }\n]","handlingStrategy":"validation","validationCode":"func checkDuplicateClients(inbound Inbound) error {\n    seenID := map[string]string{}\n    for _, c := range inbound.Settings.Clients {\n        if prev, dup := seenID[c.ID]; dup {\n            return fmt.Errorf(\"duplicate UUID shared by %q and %q\", prev, c.Email)\n        }\n        seenID[c.ID] = c.Email\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["One UUID + one email per client within a single inbound","Provisioning scripts should generate a fresh UUID per user","Lint configs for duplicate ids before deploy"],"tags":["vless","config","duplicate","inbound"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}