XTLS/Xray-core · error
failed to build sniffing config
Error message
failed to build sniffing config
What it means
Wrapper error from LoopbackConfig.Build when the embedded SniffingConfig fails to build. The loopback inbound forwards traffic back to another inbound by tag; its optional sniffing block is delegated to SniffingConfig.Build, and any failure there (e.g. an unrecognized destinationRestriction or malformed sniffing settings) is re-wrapped with this message and the original error as base.
Source
Thrown at infra/conf/loopback.go:19
package conf
import (
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/proxy/loopback"
"google.golang.org/protobuf/proto"
)
type LoopbackConfig struct {
InboundTag string `json:"inboundTag"`
Sniffing *SniffingConfig `json:"sniffing"`
}
func (l LoopbackConfig) Build() (proto.Message, error) {
c := &loopback.Config{InboundTag: l.InboundTag}
if l.Sniffing != nil {
sc, err := l.Sniffing.Build()
if err != nil {
return nil, errors.New("failed to build sniffing config").Base(err)
}
c.Sniffing = sc
}
return c, nil
}
View on GitHub (pinned to 7d214f8b09)
Solutions
- Inspect the chained base error — it comes from SniffingConfig.Build and names the real problem
- Simplify or remove the sniffing block on the loopback inbound to confirm it is the source
- Apply sniffing on the target inbound instead of (or in addition to) the loopback inbound if the option is unsupported there
Defensive patterns
Strategy: try-catch
Try / catch
// Go: unwrap to find the real sniffing failure
if err := loopbackConf.Build(); err != nil {
if strings.Contains(err.Error(), "failed to build sniffing config") {
// inspect errors.Unwrap(err) for the SniffingConfig root cause
}
} Prevention
- Test sniffing blocks on a normal inbound before moving them to loopback
- Keep loopback sniffing minimal; sniff on the target inbound where possible
When it happens
Trigger: Configuring a loopback inbound with a sniffing block that SniffingConfig.Build rejects — for example invalid values inside destOnlyRouteOnly-related fields or unsupported sniffing options in the current version.
Common situations: Enabling advanced sniffing options on a loopback inbound without checking they are supported; version drift where SniffingConfig gained stricter validation.
Related errors
- failed to build nameserver
- failed to build hosts
- VLESS reverse: invalid "sniffing" config
- 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/de6a71ede98dffdc.
Report an issue: GitHub.