{"record":{"id":"e09faabc7f24fb53","repo":"XTLS/Xray-core","slug":"failed-to-process-request","errorCode":null,"errorMessage":"failed to process request","messagePattern":"failed to process request","errorType":"exception","errorClass":"errors.Error","httpStatus":null,"severity":"error","filePath":"proxy/freedom/freedom.go","lineNumber":425,"sourceCode":"\t\t\t} else {\n\t\t\t\twriter = buf.NewWriter(conn)\n\t\t\t}\n\t\t} else {\n\t\t\twriter = NewPacketWriter(conn, h, defaultRule, UDPOverride, destination)\n\t\t\tif h.config.Noises != nil {\n\t\t\t\terrors.LogDebug(ctx, \"NOISE\", h.config.Noises)\n\t\t\t\twriter = &NoisePacketWriter{\n\t\t\t\t\tWriter:      writer,\n\t\t\t\t\tnoises:      h.config.Noises,\n\t\t\t\t\tfirstWrite:  true,\n\t\t\t\t\tUDPOverride: UDPOverride,\n\t\t\t\t\tremoteAddr:  net.DestinationFromAddr(conn.RemoteAddr()).Address,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif err := buf.Copy(input, writer, buf.UpdateActivity(timer)); err != nil {\n\t\t\treturn errors.New(\"failed to process request\").Base(err)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tresponseDone := func() error {\n\t\tdefer timer.SetTimeout(plcy.Timeouts.UplinkOnly)\n\t\tif 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\n\t\t\tvar writeConn net.Conn\n\t\t\tvar inTimer *signal.ActivityTimer\n\t\t\tif inbound := session.InboundFromContext(ctx); inbound != nil && inbound.Conn != nil {\n\t\t\t\twriteConn = inbound.Conn\n\t\t\t\tinTimer = inbound.Timer\n\t\t\t}\n\t\t\treturn proxy.CopyRawConnIfExist(ctx, conn, writeConn, link.Writer, timer, inTimer)\n\t\t}\n\t\tvar reader buf.Reader\n\t\tif destination.Network == net.Network_TCP {","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/freedom/freedom.go#L407-L443","documentation":"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.","triggerScenarios":"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.","commonSituations":"Idle connections cut by the uplinkOnly timeout, flaky Wi-Fi/mobile links, MTU/blackhole issues causing stalls, misconfigured noise settings on the outbound.","solutions":["Check the Base error: io.EOF on input is a normal client hangup; ErrTimeout means policy timeouts are too tight","Increase inbound settings / policy timeouts (handshake, uplinkOnly, downlinkOnly) for idle-heavy traffic","If settings.noises is set, verify packet lengths/config are valid","Reproduce with Xray access log enabled to see which side dropped first"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"```go\nif err := h.Process(ctx, link, dialer); err != nil {\n    if errors.Is(err, io.EOF) || errors.Is(err, context.Canceled) {\n        return // client hung up; not an error\n    }\n    if errors.Is(err, os.ErrDeadlineExceeded) { /* adjust timeouts */ }\n}\n```","preventionTips":["Tune uplinkOnly/handshake timeouts for idle traffic","Validate noise settings before deploy","Log Base errors, not just the wrapper text"],"tags":["freedom","uplink","copy","timeout","xray"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}