XTLS/Xray-core · error · errors.Error

failed to dispatch request

Error message

failed to dispatch request

What it means

Error "failed to dispatch request" thrown in XTLS/Xray-core.

Source

Thrown at proxy/http/server.go:201

	if buffer.Buffered() > 0 {
		payload, err := buf.ReadFrom(io.LimitReader(buffer, int64(buffer.Buffered())))
		if err != nil {
			return err
		}
		reader = &buf.BufferedReader{Reader: reader, Buffer: payload}
		buffer = nil
	}

	if inbound.CanSpliceCopy == 2 {
		inbound.CanSpliceCopy = 1
	}
	if err := dispatcher.DispatchLink(
		ctx, dest, &transport.Link{
			Reader: reader,
			Writer: buf.NewWriter(conn),
		},
	); err != nil {
		return errors.New("failed to dispatch request").Base(err)
	}
	return nil
}

var errWaitAnother = errors.New("keep alive")

func (s *Server) handlePlainHTTP(ctx context.Context, request *http.Request, writer io.Writer, dest net.Destination, dispatcher routing.Dispatcher) error {
	if !s.config.AllowTransparent && request.URL.Host == "" {
		// RFC 2068 (HTTP/1.1) requires URL to be absolute URL in HTTP proxy.
		response := &http.Response{
			Status:        "Bad Request",
			StatusCode:    400,
			Proto:         "HTTP/1.1",
			ProtoMajor:    1,
			ProtoMinor:    1,
			Header:        http.Header(make(map[string][]string)),
			Body:          nil,
			ContentLength: 0,

View on GitHub (pinned to 7d214f8b09)

When it happens

Trigger: Thrown at proxy/http/server.go:201 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/b5e0eaf9b623fdce. Report an issue: GitHub.