XTLS/Xray-core · error · errors.Error
no network specified
Error message
no network specified
What it means
DokodemoDoor.Init rejects a config whose AllowedNetworks list is empty. The dokodemo-door inbound must be told which networks (tcp/udp) to accept; an empty NetworkList means the listener would have no traffic domain. This error surfaces at server construction, i.e. it is one of the causes behind "failed to create server" (error 548).
Source
Thrown at proxy/dokodemo/dokodemo.go:46
return d.Init(config.(*Config), pm, session.SockoptFromContext(ctx))
})
return d, err
}))
}
type DokodemoDoor struct {
policyManager policy.Manager
config *Config
rewriteAddress net.Address
rewritePort net.Port
portMap map[string]string
sockopt *session.Sockopt
}
// Init initializes the DokodemoDoor instance with necessary parameters.
func (d *DokodemoDoor) Init(config *Config, pm policy.Manager, sockopt *session.Sockopt) error {
if len(config.AllowedNetworks) == 0 {
return errors.New("no network specified")
}
d.config = config
d.rewriteAddress = config.GetPredefinedAddress()
d.rewritePort = net.Port(config.RewritePort)
d.portMap = config.PortMap
d.policyManager = pm
d.sockopt = sockopt
return nil
}
// Network implements proxy.Inbound.
func (d *DokodemoDoor) Network() []net.Network {
if slices.Contains(d.config.AllowedNetworks, net.Network_TCP) {
return append(d.config.AllowedNetworks, net.Network_UNIX)
}
return d.config.AllowedNetworks
}View on GitHub (pinned to 7d214f8b09)
Solutions
- Add "network" to the inbound settings with at least one of tcp or udp
- Use explicit lowercase tokens: "tcp", "udp", or "tcp,udp"
- Validate the whole config boots before deploying (xray run -test or a staging start)
- Check the config schema docs for dokodemo-door settings if unsure of accepted values
Example fix
// before
{"protocol":"dokodemo-door","port":1080,"settings":{}}
// after
{"protocol":"dokodemo-door","port":1080,"settings":{"network":"tcp,udp"}} Defensive patterns
Strategy: validation
Validate before calling
func validDokodemo(cfg *dokodemo.Config) bool { return len(cfg.AllowedNetworks) > 0 }
if !validDokodemo(conf) { return errors.New("set settings.network to tcp and/or udp") } Try / catch
if err := d.Init(config, pm, sockopt); err != nil {
if err.Error() == "no network specified" { config.AllowedNetworks = []string{"tcp", "udp"}; err = d.Init(config, pm, sockopt) }
if err != nil { return err }
} Prevention
- Template dokodemo inbounds always include settings.network
- Validate inbound settings with a config linter before deploy
- Check schema docs when converting between JSON/TOML/YAML
When it happens
Trigger: A dokodemo-door inbound JSON/TOML/YAML config where the "network" field is omitted or set to an empty/unparsable value, e.g. {"protocol":"dokodemo-door","port":1080} with no "settings.network".
Common situations: Minimal configs copied from tutorials that skip settings; "network": "" or a typo like "TCP" (parser is case-sensitive to valid tokens) producing an empty list; JSON-to-TOML conversion dropping the field.
Related errors
- invalid portMap: {}
- can't get inbound proxy from handler.
- failed to get handler:
- failed to get outbound handler with tag: ${tag}
- existing tag found: ${tag}
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/3cf7c0d0b2558c83.
Report an issue: GitHub.