XTLS/Xray-core · error
unsupported domain strategy:
Error message
unsupported domain strategy:
What it means
Thrown while building SocketConfig when the 'domainStrategy' string inside 'sockopt' does not match any supported value. The switch accepts only AsIs, UseIP, UseIPv4, UseIPv6, UseIP46, UseIP64, ForceIP, ForceIPv4, ForceIPv6, ForceIPv4v6, ForceIPv6v4 (case-sensitive as written in the source); anything else hits the default branch. Note this is the sockopt-level strategy, distinct from the top-level outbound 'domainStrategy'.
Source
Thrown at infra/conf/transport_sockopt.go:120
dStrategy = internet.DomainStrategy_USE_IP4
case "useipv6":
dStrategy = internet.DomainStrategy_USE_IP6
case "useipv4v6":
dStrategy = internet.DomainStrategy_USE_IP46
case "useipv6v4":
dStrategy = internet.DomainStrategy_USE_IP64
case "forceip":
dStrategy = internet.DomainStrategy_FORCE_IP
case "forceipv4":
dStrategy = internet.DomainStrategy_FORCE_IP4
case "forceipv6":
dStrategy = internet.DomainStrategy_FORCE_IP6
case "forceipv4v6":
dStrategy = internet.DomainStrategy_FORCE_IP46
case "forceipv6v4":
dStrategy = internet.DomainStrategy_FORCE_IP64
default:
return nil, errors.New("unsupported domain strategy: ", c.DomainStrategy)
}
var customSockopts []*internet.CustomSockopt
for _, copt := range c.CustomSockopt {
customSockopt := &internet.CustomSockopt{
System: copt.Syetem,
Network: copt.Network,
Level: copt.Level,
Opt: copt.Opt,
Value: copt.Value,
Type: copt.Type,
}
customSockopts = append(customSockopts, customSockopt)
}
addressPortStrategy := internet.AddressPortStrategy_None
switch strings.ToLower(c.AddressPortStrategy) {View on GitHub (pinned to 7d214f8b09)
Solutions
- Use one of the exact camelCase values: "AsIs", "UseIP", "UseIPv4", "UseIPv6", "UseIP46", "UseIP64", "ForceIP", "ForceIPv4", "ForceIPv6", "ForceIPv4v6", "ForceIPv6v4"
- Check for typos and stray whitespace in the value
- Remove the key to fall back to the default behavior if sockopt-level domain strategy is not required
Example fix
// before
"sockopt": { "domainStrategy": "use-ipv4" }
// after
"sockopt": { "domainStrategy": "UseIPv4" } Defensive patterns
Strategy: validation
Validate before calling
var sockoptDomainStrategies = map[string]bool{
"AsIs": true, "UseIP": true, "UseIPv4": true, "UseIPv6": true,
"UseIP46": true, "UseIP64": true, "ForceIP": true, "ForceIPv4": true,
"ForceIPv6": true, "ForceIPv4v6": true, "ForceIPv6v4": true,
}
if s, ok := sockopt["domainStrategy"]; ok {
if !sockoptDomainStrategies[s.(string)] {
return fmt.Errorf("invalid sockopt.domainStrategy: %q", s)
}
} Prevention
- Keep an allow-list of strategy literals in config tooling and validate before writing
- Remember sockopt.domainStrategy is case-sensitive camelCase, unlike some other Xray enums
- Run `xray run -test` in CI for every config change
When it happens
Trigger: Setting "sockopt": { "domainStrategy": "use-ip" } (kebab-case), "Use_IP", "Asis", or a typo like "UzeIP" in streamSettings of any inbound/outbound.
Common situations: Mixing up casing conventions with other Xray fields that are case-insensitive, porting a V2Ray config that used different spellings, or assuming kebab-case like the DNS strategy names.
Related errors
- unsupported address and port strategy:
- Unable to locate a fake DNS Engine
- failed to parse name server: {}
- nameserver address is not specified
- not an IP address:{}
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/2bf61d58082115ab.
Report an issue: GitHub.