XTLS/Xray-core · error
unsupported padding placement:
Error message
unsupported padding placement:
What it means
SplitHTTPConfig.Build() validates "xPaddingPlacement" in a switch at transport_method.go:346-352. Empty defaults to "queryInHeader"; only "cookie", "header", "query", "queryInHeader" are accepted; anything else appends the bad value to this error.
Source
Thrown at infra/conf/transport_method.go:351
if c.XPaddingBytes != (Int32Range{}) && (c.XPaddingBytes.From <= 0 || c.XPaddingBytes.To <= 0) {
return nil, errors.New("xPaddingBytes cannot be disabled")
}
if c.XPaddingKey == "" {
c.XPaddingKey = "x_padding"
}
if c.XPaddingHeader == "" {
c.XPaddingHeader = "X-Padding"
}
switch c.XPaddingPlacement {
case "":
c.XPaddingPlacement = "queryInHeader"
case "cookie", "header", "query", "queryInHeader":
default:
return nil, errors.New("unsupported padding placement: " + c.XPaddingPlacement)
}
switch c.XPaddingMethod {
case "":
c.XPaddingMethod = "repeat-x"
case "repeat-x", "tokenish":
default:
return nil, errors.New("unsupported padding method: " + c.XPaddingMethod)
}
switch c.UplinkDataPlacement {
case "":
c.UplinkDataPlacement = splithttp.PlacementAuto
case splithttp.PlacementAuto, splithttp.PlacementBody:
case splithttp.PlacementCookie, splithttp.PlacementHeader:
if c.Mode != "packet-up" {
return nil, errors.New("UplinkDataPlacement can be " + c.UplinkDataPlacement + " only in packet-up mode")
}View on GitHub (pinned to 7d214f8b09)
Solutions
- Use one of: "cookie", "header", "query", "queryInHeader" (exact camelCase)
- Omit "xPaddingPlacement" to accept the "queryInHeader" default
Example fix
// before "xPaddingPlacement": "query-in-header" // after "xPaddingPlacement": "queryInHeader"
Defensive patterns
Strategy: type-guard
Type guard
func validXPaddingPlacement(p string) bool {
switch p {
case "", "cookie", "header", "query", "queryInHeader":
return true
}
return false
} Prevention
- Use exact camelCase "queryInHeader" — not hyphenated forms
- Omit the field to accept the queryInHeader default
When it happens
Trigger: "xPaddingPlacement": "query-in-header" (hyphenated instead of camelCase), "body", "none", or any string outside the four allowed values in splithttp transportSettings. Note the default is queryInHeader — writing an invalid value explicitly is the only way to hit this.
Common situations: Guessing placement names from the padding docs instead of the enum; using hyphenated forms consistent with mode names ("packet-up") which don't apply here; stale third-party config generators.
Related errors
- xPaddingBytes cannot be disabled
- unsupported padding method:
- not a Service.
- Dispatcher: Invalid destination.
- FakeDNSEngine is not initialized, but such a sniffer is used
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/0cffc8aaff6dd365.
Report an issue: GitHub.