XTLS/Xray-core · error

failed to build inbound handler for protocol

Error message

failed to build inbound handler for protocol {c.Protocol}

What it means

Inbound detour Build successfully loaded the raw settings but the protocol config's own Build() failed; the chained error carries the protocol-specific validation failure, wrapped with the protocol tag for context.

Solutions

  1. Fix the protocol settings per the Base error's validation message
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at infra/conf/xray.go:203 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/e69dd9a7fa42fe7c. Report an issue: GitHub.

Appendix: source

Thrown at infra/conf/xray.go:203

			return nil, errors.New("failed to build sniffing config").Base(err)
		}
		receiverSettings.SniffingSettings = s
	}

	settings := []byte("{}")
	if c.Settings != nil {
		settings = ([]byte)(*c.Settings)
	}
	rawConfig, err := inboundConfigLoader.LoadWithID(settings, c.Protocol)
	if err != nil {
		return nil, errors.New("failed to load inbound detour config for protocol ", c.Protocol).Base(err)
	}
	if dokodemoConfig, ok := rawConfig.(*DokodemoConfig); ok {
		receiverSettings.ReceiveOriginalDestination = dokodemoConfig.FollowRedirect
	}
	ts, err := rawConfig.(Buildable).Build()
	if err != nil {
		return nil, errors.New("failed to build inbound handler for protocol ", c.Protocol).Base(err)
	}

	return &core.InboundHandlerConfig{
		Tag:              c.Tag,
		ReceiverSettings: serial.ToTypedMessage(receiverSettings),
		ProxySettings:    serial.ToTypedMessage(ts),
	}, nil
}

type OutboundDetourConfig struct {
	Protocol       string           `json:"protocol"`
	SendThrough    *string          `json:"sendThrough"`
	Tag            string           `json:"tag"`
	Settings       *json.RawMessage `json:"settings"`
	StreamSetting  *StreamConfig    `json:"streamSettings"`
	ProxySettings  *ProxyConfig     `json:"proxySettings"`
	MuxSettings    *MuxConfig       `json:"mux"`
	TargetStrategy string           `json:"targetStrategy"`

View on GitHub (pinned to 7d214f8b09)