{"record":{"id":"de6a71ede98dffdc","repo":"XTLS/Xray-core","slug":"failed-to-build-sniffing-config","errorCode":null,"errorMessage":"failed to build sniffing config","messagePattern":"failed to build sniffing config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/loopback.go","lineNumber":19,"sourceCode":"package conf\n\nimport (\n\t\"github.com/xtls/xray-core/common/errors\"\n\t\"github.com/xtls/xray-core/proxy/loopback\"\n\t\"google.golang.org/protobuf/proto\"\n)\n\ntype LoopbackConfig struct {\n\tInboundTag string          `json:\"inboundTag\"`\n\tSniffing   *SniffingConfig `json:\"sniffing\"`\n}\n\nfunc (l LoopbackConfig) Build() (proto.Message, error) {\n\tc := &loopback.Config{InboundTag: l.InboundTag}\n\tif l.Sniffing != nil {\n\t\tsc, err := l.Sniffing.Build()\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(\"failed to build sniffing config\").Base(err)\n\t\t}\n\t\tc.Sniffing = sc\n\t}\n\treturn c, nil\n}\n","sourceCodeStart":1,"sourceCodeEnd":25,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/loopback.go#L1-L25","documentation":"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.","triggerScenarios":"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.","commonSituations":"Enabling advanced sniffing options on a loopback inbound without checking they are supported; version drift where SniffingConfig gained stricter validation.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Go: unwrap to find the real sniffing failure\nif err := loopbackConf.Build(); err != nil {\n\tif strings.Contains(err.Error(), \"failed to build sniffing config\") {\n\t\t// inspect errors.Unwrap(err) for the SniffingConfig root cause\n\t}\n}","preventionTips":["Test sniffing blocks on a normal inbound before moving them to loopback","Keep loopback sniffing minimal; sniff on the target inbound where possible"],"tags":["xray","config","loopback","sniffing","wrapper-error"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}