XTLS/Xray-core · error

unsupported method ${method}

Error message

unsupported method ${method}

What it means

Config error when creating a shadowsocks-2022 inbound: config.Method is not present in shadowaead_2022.List. Only the 2022 AEAD family is accepted here (2022-blake3-aes-128-gcm, 2022-blake3-aes-256-gcm, 2022-blake3-chacha20-poly1305) — plain AEAD or legacy names valid for the classic shadowsocks inbound are rejected in this handler.

Source

Thrown at proxy/shadowsocks_2022/inbound.go:55

	email    string
	level    int
}

func NewServer(ctx context.Context, config *ServerConfig) (*Inbound, error) {
	networks := config.Network
	if len(networks) == 0 {
		networks = []net.Network{
			net.Network_TCP,
			net.Network_UDP,
		}
	}
	inbound := &Inbound{
		networks: networks,
		email:    config.Email,
		level:    int(config.Level),
	}
	if !C.Contains(shadowaead_2022.List, config.Method) {
		return nil, errors.New("unsupported method ", config.Method)
	}
	service, err := shadowaead_2022.NewServiceWithPassword(config.Method, config.Key, 500, inbound, nil)
	if err != nil {
		return nil, errors.New("create service").Base(err)
	}
	inbound.service = service
	return inbound, nil
}

func (i *Inbound) Network() []net.Network {
	return i.networks
}

func (i *Inbound) Process(ctx context.Context, network net.Network, connection stat.Connection, dispatcher routing.Dispatcher) error {
	inbound := session.InboundFromContext(ctx)
	inbound.Name = "shadowsocks-2022"
	inbound.CanSpliceCopy = 3

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Set method to one of: 2022-blake3-aes-128-gcm, 2022-blake3-aes-256-gcm, or 2022-blake3-chacha20-poly1305.
  2. If you intended classic AEAD, use protocol "shadowsocks" instead of "shadowsocks-2022".
  3. Validate the config with xray run -test before deploying.

Example fix

// before
{ "protocol": "shadowsocks-2022", "settings": { "method": "aes-256-gcm", "password": "..." } }
// after
{ "protocol": "shadowsocks-2022", "settings": { "method": "2022-blake3-aes-256-gcm", "password": "<base64-32B-key>" } }
Defensive patterns

Strategy: validation

Validate before calling

var ss2022Methods = []string{
  "2022-blake3-aes-128-gcm",
  "2022-blake3-aes-256-gcm",
  "2022-blake3-chacha20-poly1305",
}
func validateSS2022Method(m string) error {
  for _, s := range ss2022Methods { if s == m { return nil } }
  return fmt.Errorf("unsupported method %q; expected one of %v", m, ss2022Methods)
}

Type guard

func isSS2022Method(m string) bool {
  return slices.Contains([]string{"2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305"}, m)
}

Prevention

When it happens

Trigger: Building a shadowsocks-2022 inbound whose method field is e.g. aes-256-gcm, chacha20-ietf-poly1305, or a typo'd 2022 name; the C.Contains check fails and returns this error before any service construction.

Common situations: Copying a classic Shadowsocks inbound and switching protocol to shadowsocks-2022 without changing the method; panel defaulting to aes-256-gcm; confusion between the two shadowsocks protocol handlers.

Related errors


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