XTLS/Xray-core · error

select padding profile: %w

Error message

select padding profile: %w

What it means

Wraps any error from newClientPaddingSchedule2612, which selects the wire-format padding schedule for the client connection. The %w means the underlying cause is chained; the schedule construction depends on built-in profile data, so failure indicates an internal inconsistency rather than user input.

Source

Thrown at transport/internet/finalmask/xmc/client.go:53

}

type clientState int

var (
	clientStateHandshake clientState = 1
	clientStateProxy     clientState = 2
)

func newClientConn(c net.Conn, profiles []loginProfile, password string, rsaPublicKey []byte, hostname string) (*clientConn, error) {
	if len(rsaPublicKey) == 0 {
		return nil, fmt.Errorf("empty rsa public key")
	}
	if len(profiles) == 0 {
		return nil, fmt.Errorf("empty profiles")
	}
	paddingSchedule, err := newClientPaddingSchedule2612()
	if err != nil {
		return nil, fmt.Errorf("select padding profile: %w", err)
	}
	return &clientConn{
		reader:          bufio.NewReader(c),
		writer:          c,
		c:               c,
		state:           clientStateHandshake,
		handshakeLock:   sync.Mutex{},
		profiles:        profiles,
		password:        password,
		rsaPublicKey:    rsaPublicKey,
		hostname:        hostname,
		paddingSchedule: paddingSchedule,
		deadlines:       newConnectionDeadlines(c),
	}, nil
}

func (c *clientConn) handshake() error {
	c.handshakeLock.Lock()

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Rebuild/reinstall so all transport packages come from one consistent version.
  2. Inspect the chained error (unwrap %w) to see which profile entry failed.
  3. Report upstream if it reproduces on an unmodified build.
Defensive patterns

Strategy: try-catch

Try / catch

cc, err := newClientConn(conn, profiles, password, rsaKey, hostname)
if err != nil {
	var ppErr *paddingProfileError // if the library exposes typed causes
	if errors.As(err, &ppErr) {
		return fmt.Errorf("inconsistent transport build: %w; rebuild from one version", err)
	}
	return err
}

Prevention

When it happens

Trigger: newClientPaddingSchedule2612 returning an error during connection construction, e.g. after the built-in 2612 padding profile table was modified or corrupted between versions. Not triggered by network conditions or remote peers.

Common situations: Mixing compiled artifacts from different transport versions; a patched build with an invalid padding profile table. Effectively unreachable on stock builds.

Related errors


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