XTLS/Xray-core · error
Trojan server address is not set.
Error message
Trojan server address is not set.
What it means
Trojan client config Build iterates the (already length-checked) server list and finds a server entry with no address; without a host the outbound cannot dial, so the entry is rejected before port/password checks.
Solutions
- Add "address": "your.server.example" to the servers entry
- Verify the key name is exactly "address" (not "server"/"host"/"addr")
- If using the legacy flat form, set the top-level "address" field
Example fix
// before
{ "port": 443, "password": "secret" }
// after
{ "address": "trojan.example.com", "port": 443, "password": "secret" } Defensive patterns
Strategy: validation
Validate before calling
for _, s := range servers {
if !gjson.Valid(s.Raw) || gjson.Get(s.Raw, "address").Type != gjson.String {
return errors.New("trojan server entry is missing a string \"address\"")
}
} Prevention
- Fail fast in generators when any required endpoint field is empty
- Use the exact key name "address"
When it happens
Trigger: A servers entry like { "port": 443, "password": "x" } with no "address" key, or "address": null.
Common situations: Templating a config and leaving the address placeholder empty, or accidentally renaming the key (e.g. "server" or "host") instead of "address".
Related errors
- failed to get server spec
- Invalid Trojan port.
- Trojan fallbacks: please fill in a valid value for every…
- Trojan password is not specified.
- both file and bytes are empty.
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/a94bdfcb9a3239ec.
Report an issue: GitHub.
Appendix: source
Thrown at infra/conf/trojan.go:65
{
Address: c.Address,
Port: c.Port,
Level: c.Level,
Email: c.Email,
Password: c.Password,
Flow: c.Flow,
},
}
}
if len(c.Servers) != 1 {
return nil, errors.New(`Trojan settings: "servers" should have one and only one member. Multiple endpoints in "servers" should use multiple Trojan outbounds and routing balancer instead`)
}
config := &trojan.ClientConfig{}
for _, rec := range c.Servers {
if rec.Address == nil {
return nil, errors.New("Trojan server address is not set.")
}
if rec.Port == 0 {
return nil, errors.New("Invalid Trojan port.")
}
if rec.Password == "" {
return nil, errors.New("Trojan password is not specified.")
}
if rec.Flow != "" {
return nil, errors.PrintRemovedFeatureError(`Flow for Trojan`, ``)
}
config.Server = &protocol.ServerEndpoint{
Address: rec.Address.Build(),
Port: uint32(rec.Port),
User: &protocol.User{
Level: uint32(rec.Level),
Email: rec.Email,
Account: serial.ToTypedMessage(&trojan.Account{View on GitHub (pinned to 7d214f8b09)