{"record":{"id":"c04c5961479e6e2c","repo":"XTLS/Xray-core","slug":"vless-reverse-invalid-sniffing-config","errorCode":null,"errorMessage":"VLESS reverse: invalid \"sniffing\" config","messagePattern":"VLESS reverse: invalid \"sniffing\" config","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/vless.go","lineNumber":232,"sourceCode":"\treturn config, nil\n}\n\ntype VLessReverseConfig struct {\n\tTag      string          `json:\"tag\"`\n\tSniffing *SniffingConfig `json:\"sniffing\"`\n}\n\nfunc (c *VLessReverseConfig) Build() (*vless.Reverse, error) {\n\tif c.Tag == \"\" {\n\t\treturn nil, errors.New(`VLESS reverse: \"tag\" can't be empty`)\n\t}\n\tr := &vless.Reverse{\n\t\tTag: c.Tag,\n\t}\n\tif c.Sniffing != nil {\n\t\tsc, err := c.Sniffing.Build()\n\t\tif err != nil {\n\t\t\treturn nil, errors.New(`VLESS reverse: invalid \"sniffing\" config`).Base(err)\n\t\t}\n\t\tr.Sniffing = sc\n\t}\n\treturn r, nil\n}\n\ntype VLessOutboundVnext struct {\n\tAddress *Address          `json:\"address\"`\n\tPort    uint16            `json:\"port\"`\n\tUsers   []json.RawMessage `json:\"users\"`\n}\n\ntype VLessOutboundConfig struct {\n\tAddress    *Address              `json:\"address\"`\n\tPort       uint16                `json:\"port\"`\n\tLevel      uint32                `json:\"level\"`\n\tEmail      string                `json:\"email\"`\n\tId         string                `json:\"id\"`","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/vless.go#L214-L250","documentation":"Thrown by VLessReverseConfig.Build() when the optional \"sniffing\" object inside a VLESS reverse config fails to build. The reverse builder delegates to SniffingConfig.Build() and wraps any failure with this message; the underlying cause is attached via .Base(err). Typical inner failures are an invalid \"destOnly\"/\"target\" combination or unrecognized sniffing targets.","triggerScenarios":"\"reverse\":{\"tag\":\"x\",\"sniffing\":{\"enabled\":true,\"destOnly\":\"yes\"}} — wrong field types; sniffing targets that are not in the supported list (http, tls, quic, fakedns, etc.); malformed regex-only sniffing options.","commonSituations":"Copying a sniffing block from an inbound (where fields differ) into the reverse object; version drift where supported sniffing target names changed between Xray releases.","solutions":["Inspect the wrapped inner error (err) — it names the exact sniffing field that failed","Use only supported sniffing targets: \"http\", \"tls\", \"quic\", \"fakedns\", \"fakedns+others\" as appropriate for your version","Simplify: start with \"sniffing\":{\"enabled\":true,\"target\":[\"http\",\"tls\"]} and add fields back one at a time","Remove \"sniffing\" from the reverse object if content sniffing is not needed for the tunnel"],"exampleFix":"// before\n\"reverse\": { \"tag\": \"t\", \"sniffing\": { \"enabled\": true, \"destOnly\": \"yes\" } }\n// after\n\"reverse\": { \"tag\": \"t\", \"sniffing\": { \"enabled\": true, \"target\": [\"http\", \"tls\"] } }","handlingStrategy":"try-catch","validationCode":"func validateReverseSniffing(rev map[string]any) error {\n\tsn, ok := rev[\"sniffing\"].(map[string]any)\n\tif !ok { return nil }\n\tfor _, t := range []string{\"enabled\"} {\n\t\tif v, ok := sn[t]; ok {\n\t\t\tif _, ok := v.(bool); !ok {\n\t\t\t\treturn fmt.Errorf(\"reverse.sniffing.%s must be boolean\", t)\n\t\t\t}\n\t\t}\n\t}\n\tif targets, ok := sn[\"target\"].([]any); ok {\n\t\tvalid := map[string]bool{\"http\": true, \"tls\": true, \"quic\": true, \"fakedns\": true}\n\t\tfor _, t := range targets {\n\t\t\ts, _ := t.(string)\n\t\t\tif !valid[s] {\n\t\t\t\treturn fmt.Errorf(\"reverse.sniffing.target %q not supported\", s)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"config, err := jsonToCoreConfig(raw)\nif err != nil {\n\tvar buildErr *errors.Error\n\tif strings.Contains(err.Error(), `VLESS reverse: invalid \"sniffing\" config`) {\n\t\t// unwrap and log the Base cause, point the user at the sniffing block\n\t\tlog.Printf(\"reverse sniffing misconfigured: %v\", errors.Unwrap(err))\n\t}\n\treturn err\n}","preventionTips":["When sniffing build fails, always inspect the wrapped inner error — it names the real field","Start from a minimal {\"enabled\":true,\"target\":[\"http\",\"tls\"]} block and extend incrementally","Track supported sniffing targets per Xray version in your config generator"],"tags":["vless","reverse","sniffing","config","validation","xray"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}