XTLS/Xray-core · error

first padding length must not be smaller than 35

Error message

first padding length must not be smaller than 35

What it means

ParsePadding constraint on the first padding turn: for i==0 the parameters must satisfy min>=100, and both max bounds >= 35 (18+17), because the first record must carry the mandatory handshake overhead. A first turn below these floors cannot cover the required prefix and is rejected.

Solutions

  1. Raise the first turn's parameters to min>=100 and both maxima >=35
  2. Consult the documented padding format for valid first-turn values
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at proxy/vless/encryption/common.go:244 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/6ce3930149c5e0ca. Report an issue: GitHub.

Appendix: source

Thrown at proxy/vless/encryption/common.go:244

	}
	maxLen := 0
	for i, s := range strings.Split(padding, ".") {
		x := strings.Split(s, "-")
		if len(x) < 3 || x[0] == "" || x[1] == "" || x[2] == "" {
			return errors.New("invalid padding lenth/gap parameter: " + s)
		}
		y := [3]int{}
		if y[0], err = strconv.Atoi(x[0]); err != nil {
			return
		}
		if y[1], err = strconv.Atoi(x[1]); err != nil {
			return
		}
		if y[2], err = strconv.Atoi(x[2]); err != nil {
			return
		}
		if i == 0 && (y[0] < 100 || y[1] < 18+17 || y[2] < 18+17) {
			return errors.New("first padding length must not be smaller than 35")
		}
		if i%2 == 0 {
			*paddingLens = append(*paddingLens, y)
			maxLen += max(y[1], y[2])
		} else {
			*paddingGaps = append(*paddingGaps, y)
		}
	}
	if maxLen > 18+65535 {
		return errors.New("total padding length must not be larger than 65553")
	}
	return
}

func CreatPadding(paddingLens, paddingGaps [][3]int) (length int, lens []int, gaps []time.Duration) {
	if len(paddingLens) == 0 {
		paddingLens = [][3]int{{100, 111, 1111}, {50, 0, 3333}}
		paddingGaps = [][3]int{{75, 0, 111}}

View on GitHub (pinned to 7d214f8b09)