{"record":{"id":"06e1c4bec7a3ed87","repo":"XTLS/Xray-core","slug":"failed-to-get-trojan-user","errorCode":null,"errorMessage":"failed to get trojan user","messagePattern":"failed to get trojan user","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/trojan/server.go","lineNumber":50,"sourceCode":"\t\treturn NewServer(ctx, config.(*ServerConfig))\n\t}))\n}\n\n// Server is an inbound connection handler that handles messages in trojan protocol.\ntype Server struct {\n\tpolicyManager policy.Manager\n\tvalidator     *Validator\n\tfallbacks     map[string]map[string]map[string]*Fallback // or nil\n\tcone          bool\n}\n\n// NewServer creates a new trojan inbound handler.\nfunc NewServer(ctx context.Context, config *ServerConfig) (*Server, error) {\n\tvalidator := new(Validator)\n\tfor _, user := range config.Users {\n\t\tu, err := user.ToMemoryUser()\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"failed to get trojan user\").Base(err).AtError()\n\t\t}\n\n\t\tif err := validator.Add(u); err != nil {\n\t\t\treturn nil, errors.New(\"failed to add user\").Base(err).AtError()\n\t\t}\n\t}\n\n\tv := core.MustFromContext(ctx)\n\tserver := &Server{\n\t\tpolicyManager: v.GetFeature(policy.ManagerType()).(policy.Manager),\n\t\tvalidator:     validator,\n\t\tcone:          ctx.Value(\"cone\").(bool),\n\t}\n\n\tif config.Fallbacks != nil {\n\t\tserver.fallbacks = make(map[string]map[string]map[string]*Fallback)\n\t\tfor _, fb := range config.Fallbacks {\n\t\t\tif server.fallbacks[fb.Name] == nil {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/trojan/server.go#L32-L68","documentation":"Error \"failed to get trojan user\" thrown in XTLS/Xray-core.","triggerScenarios":"Thrown at proxy/trojan/server.go:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}