XTLS/Xray-core · error

failed to build loopback sniffing request

Error message

failed to build loopback sniffing request

What it means

Loopback init fails building the sniffing request from the inbound's sniffing config (proxyman.BuildSniffingRequest); the chained error means the configured destOverride/target metadata is invalid, so the loopback handler cannot be initialized.

Solutions

  1. Fix the sniffing settings in the loopback config
  2. Disable sniffing on the loopback outbound if unneeded
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at proxy/loopback/loopback.go:59 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/37a27a7edd46f43c. Report an issue: GitHub.

Appendix: source

Thrown at proxy/loopback/loopback.go:59

		*inbound = *originInbound
	}
	inbound.Tag = l.inboundTag
	ctx = session.ContextWithInbound(ctx, inbound)

	err := l.dispatcherInstance.DispatchLink(ctx, destination, link)
	if err != nil {
		return errors.New(ctx, "failed to process loopback connection").Base(err)
	}
	return nil
}

func (l *Loopback) init(config *Config, dispatcherInstance routing.Dispatcher) error {
	l.dispatcherInstance = dispatcherInstance
	l.inboundTag = config.InboundTag
	if config.Sniffing.GetEnabled() {
		request, err := proxyman.BuildSniffingRequest(config.Sniffing)
		if err != nil {
			return errors.New("failed to build loopback sniffing request").Base(err).AtError()
		}
		l.sniffingRequest = request
	}
	return nil
}

func init() {
	common.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
		l := new(Loopback)
		err := core.RequireFeatures(ctx, func(dispatcherInstance routing.Dispatcher) error {
			return l.init(config.(*Config), dispatcherInstance)
		})
		return l, err
	}))
}

View on GitHub (pinned to 7d214f8b09)