XTLS/Xray-core · warning
failed to find the default "name" config
Error message
failed to find the default "name" config
What it means
In the trojan fallback path, after selecting a fallback 'name' from the SNI/header sniffing, napfb[name] is nil and even the unnamed default napfb[""] is nil — so no fallback group exists for this traffic at all. It is a configuration-shape error: fallbacks were configured, but none qualifies as the default.
Source
Thrown at proxy/trojan/server.go:405
if len(napfb) > 1 || napfb[""] == nil {
if name != "" && napfb[name] == nil {
match := ""
for n := range napfb {
if n != "" && strings.Contains(name, n) && len(n) > len(match) {
match = n
}
}
name = match
}
}
if napfb[name] == nil {
name = ""
}
apfb := napfb[name]
if apfb == nil {
return errors.New(`failed to find the default "name" config`).AtWarning()
}
if apfb[alpn] == nil {
alpn = ""
}
pfb := apfb[alpn]
if pfb == nil {
return errors.New(`failed to find the default "alpn" config`).AtWarning()
}
path := ""
if len(pfb) > 1 || pfb[""] == nil {
if firstLen >= 18 && first.Byte(4) != '*' { // not h2c
firstBytes := first.Bytes()
for i := 4; i <= 8; i++ { // 5 -> 9
if firstBytes[i] == '/' && firstBytes[i-1] == ' ' {
search := len(firstBytes)
if search > 64 {View on GitHub (pinned to 7d214f8b09)
Solutions
- Add a fallback entry without 'name' (empty name) to serve as the default catch-all
- Verify each fallback object's fields parse as expected (name/alpn/path/dest/type/xver) in the config
- Check the sniffed SNI actually matches the names you configured (case sensitivity)
Example fix
// json: last entry with no name/alpn/path is the required default
"fallbacks": [
{"name": "a.example.com", "dest": 8001},
{"name": "b.example.com", "dest": 8002},
{"dest": 8080}
] Defensive patterns
Strategy: validation
Validate before calling
// config validation before starting the trojan inbound
func validateFallbacks(fbs []Fallback) error {
hasDefault := false
for _, f := range fbs {
if f.Name == "" { hasDefault = true }
}
if !hasDefault {
return errors.New("fallbacks need at least one entry without 'name'")
}
return nil
} Prevention
- Always include one name-less, alpn-less, path-less fallback entry as catch-all
- Lint fallback config in CI with a JSON-schema check for the trojan inbound
- Keep fallback key discipline: name=SNI, alpn=TLS-ALPN, path=HTTP path
When it happens
Trigger: All configured fallback entries carry a 'name' that does not match the sniffed name, and no entry with an empty name was provided (the required catch-all).
Common situations: Admin adds only named fallbacks (e.g. for specific SNI domains) and forgets the default; YAML/JSON indentation puts fallbacks under the wrong key so the map builds empty.
Related errors
- Trojan fallbacks: "path" must be empty or start with "/"
- Trojan fallbacks: please fill in a valid value for every "de
- Trojan fallbacks: invalid PROXY protocol version, "xver" onl
- failed to find the default "alpn" config
- failed to find the default "path" config
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/cc1eaf56613dea7e.
Report an issue: GitHub.