XTLS/Xray-core · error · errors.Error

failed to process request

Error message

failed to process request

What it means

The uplink copy loop (client → remote) failed during buf.Copy(input, writer). This wraps any mid-stream read/write error after the connection was established: client disconnects, write to the remote failing, timeout from the policy uplink timer, or noise-writer encode failures. It is raised by requestDone inside the task group.

Source

Thrown at proxy/freedom/freedom.go:425

			} else {
				writer = buf.NewWriter(conn)
			}
		} else {
			writer = NewPacketWriter(conn, h, defaultRule, UDPOverride, destination)
			if h.config.Noises != nil {
				errors.LogDebug(ctx, "NOISE", h.config.Noises)
				writer = &NoisePacketWriter{
					Writer:      writer,
					noises:      h.config.Noises,
					firstWrite:  true,
					UDPOverride: UDPOverride,
					remoteAddr:  net.DestinationFromAddr(conn.RemoteAddr()).Address,
				}
			}
		}

		if err := buf.Copy(input, writer, buf.UpdateActivity(timer)); err != nil {
			return errors.New("failed to process request").Base(err)
		}

		return nil
	}

	responseDone := func() error {
		defer timer.SetTimeout(plcy.Timeouts.UplinkOnly)
		if destination.Network == net.Network_TCP && useSplice.Load() && proxy.IsRAWTransportWithoutSecurity(conn) { // it would be tls conn in special use case of MITM, we need to let link handle traffic
			var writeConn net.Conn
			var inTimer *signal.ActivityTimer
			if inbound := session.InboundFromContext(ctx); inbound != nil && inbound.Conn != nil {
				writeConn = inbound.Conn
				inTimer = inbound.Timer
			}
			return proxy.CopyRawConnIfExist(ctx, conn, writeConn, link.Writer, timer, inTimer)
		}
		var reader buf.Reader
		if destination.Network == net.Network_TCP {

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Check the Base error: io.EOF on input is a normal client hangup; ErrTimeout means policy timeouts are too tight
  2. Increase inbound settings / policy timeouts (handshake, uplinkOnly, downlinkOnly) for idle-heavy traffic
  3. If settings.noises is set, verify packet lengths/config are valid
  4. Reproduce with Xray access log enabled to see which side dropped first
Defensive patterns

Strategy: try-catch

Try / catch

```go
if err := h.Process(ctx, link, dialer); err != nil {
    if errors.Is(err, io.EOF) || errors.Is(err, context.Canceled) {
        return // client hung up; not an error
    }
    if errors.Is(err, os.ErrDeadlineExceeded) { /* adjust timeouts */ }
}
```

Prevention

When it happens

Trigger: Long-lived TCP stream through freedom where the inbound side errors, the remote resets mid-transfer, or buf.UpdateActivity(timer) fires because no bytes flowed within policy.Timeouts handshake/uplink limits. Noise writer path (settings.noises) failing to serialize the first packet also lands here.

Common situations: Idle connections cut by the uplinkOnly timeout, flaky Wi-Fi/mobile links, MTU/blackhole issues causing stalls, misconfigured noise settings on the outbound.

Related errors


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