{"record":{"id":"02d99ffca570282f","repo":"XTLS/Xray-core","slug":"failed-to-parse-user","errorCode":null,"errorMessage":"failed to parse user","messagePattern":"failed to parse user","errorType":"exception","errorClass":"errors.Error","httpStatus":null,"severity":"error","filePath":"app/proxyman/command/command.go","lineNumber":49,"sourceCode":"\tif !ok {\n\t\treturn nil, errors.New(\"can't get inbound proxy from handler.\")\n\t}\n\treturn gi.GetInbound(), nil\n}\n\n// ApplyInbound implements InboundOperation.\nfunc (op *AddUserOperation) ApplyInbound(ctx context.Context, handler inbound.Handler) error {\n\tp, err := getInbound(handler)\n\tif err != nil {\n\t\treturn err\n\t}\n\tum, ok := p.(proxy.UserManager)\n\tif !ok {\n\t\treturn errors.New(\"proxy is not a UserManager\")\n\t}\n\tmUser, err := op.User.ToMemoryUser()\n\tif err != nil {\n\t\treturn errors.New(\"failed to parse user\").Base(err)\n\t}\n\treturn um.AddUser(ctx, mUser)\n}\n\n// ApplyInbound implements InboundOperation.\nfunc (op *RemoveUserOperation) ApplyInbound(ctx context.Context, handler inbound.Handler) error {\n\tp, err := getInbound(handler)\n\tif err != nil {\n\t\treturn err\n\t}\n\tum, ok := p.(proxy.UserManager)\n\tif !ok {\n\t\treturn errors.New(\"proxy is not a UserManager\")\n\t}\n\treturn um.RemoveUser(ctx, op.Email)\n}\n\ntype handlerServer struct {","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/app/proxyman/command/command.go#L31-L67","documentation":"Returned by AddUserOperation.ApplyInbound (app/proxyman/command/command.go:49) when protocol.User.ToMemoryUser() fails while converting the protobuf user into an in-memory user. The Base error carries the protocol-specific reason — most often an unparsable or missing account message (e.g. a VMess user without a valid id UUID, or an account whose serialized message cannot be deserialized into the expected type).","triggerScenarios":"Calling AddUser with a User whose Account's type_url does not match any registered account proto, or whose payload fails validation: invalid UUID for VMess/VLESS, malformed password encoding, or empty account.","commonSituations":"Panels generating bad UUIDs (wrong length, non-hex characters), missing the account entirely, or version skew where the client's proto enum for the account type differs from the server's.","solutions":["Inspect the chained Base error — it names the account parsing failure precisely.","Regenerate the user's credential (UUID for vmess/vless) with a proper generator.","Ensure the Account Any message's type_url matches the account proto of the target inbound's protocol.","Update client and server to matching xray-core versions if account protos changed."],"exampleFix":"// before\nuser.Account = &anypb.Any{TypeUrl: \"xray.proxy.vmess.Account\", Value: badPayload}\n\n// after — build the account with a valid UUID\naccount := &vmess.Account{Id: \"b831381d-6324-4d53-ad4f-8cda48b30811\"}\nuser.Account = serial.ToTypedMessage(account)","handlingStrategy":"validation","validationCode":"// validate credentials before sending AddUser\nif _, err := uuid.Parse(user.Id); err != nil {\n    return fmt.Errorf(\"invalid UUID %q for user %q\", user.Id, user.Email)\n}","typeGuard":null,"tryCatchPattern":"if err := addOp.ApplyInbound(ctx, handler); err != nil {\n    if strings.Contains(err.Error(), \"failed to parse user\") { rejectUserPayload(user) } else { return err }\n}","preventionTips":["Generate UUIDs with a real UUID library, never by hand.","Attach the account via serial.ToTypedMessage so type_url is always correct.","Keep client/server xray-core versions aligned."],"tags":["go","xray","api","users","validation"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}