XTLS/Xray-core · error

total padding length must not be larger than 65553

Error message

total padding length must not be larger than 65553

What it means

ParsePadding aggregate limit: summing max(min,max) over all even-indexed (length) turns exceeds 18+65535. The combined padding would overflow the framing's total length budget, so the schedule as a whole is rejected even if each turn is individually valid.

Solutions

  1. Reduce the number of padding turns or their maximum lengths so the total stays <= 65553
  2. Move large padding budgets into gap turns if appropriate
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at proxy/vless/encryption/common.go:254 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/d2a32d385212fa2b. Report an issue: GitHub.

Appendix: source

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

		}
		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}}
	}
	for _, y := range paddingLens {
		l := 0
		if y[0] >= int(crypto.RandBetween(0, 100)) {
			l = int(crypto.RandBetween(int64(y[1]), int64(y[2])))
		}
		lens = append(lens, l)
		length += l
	}
	for _, y := range paddingGaps {

View on GitHub (pinned to 7d214f8b09)