XTLS/Xray-core · info
failed to deliver response payload
Error message
failed to deliver response payload
What it means
Downlink copy from the fallback backend to the trojan client failed (buf.Copy serverReader→writer on the client conn) during fallback relaying. AtInfo severity, same best-effort rationale as [732].
Source
Thrown at proxy/trojan/server.go:537
p2, _ := strconv.ParseUint(localPort, 10, 16)
common.Must2(pro.Write([]byte{byte(p1 >> 8), byte(p1), byte(p2 >> 8), byte(p2)}))
}
if err := serverWriter.WriteMultiBuffer(buf.MultiBuffer{pro}); err != nil {
return errors.New("failed to set PROXY protocol v", fb.Xver).Base(err).AtWarning()
}
}
if err := buf.Copy(reader, serverWriter, buf.UpdateActivity(timer)); err != nil {
return errors.New("failed to fallback request payload").Base(err).AtInfo()
}
return nil
}
writer := buf.NewWriter(connection)
getResponse := func() error {
defer timer.SetTimeout(sessionPolicy.Timeouts.UplinkOnly)
if err := buf.Copy(serverReader, writer, buf.UpdateActivity(timer)); err != nil {
return errors.New("failed to deliver response payload").Base(err).AtInfo()
}
return nil
}
if err := task.Run(ctx, task.OnSuccess(postRequest, task.Close(serverWriter)), task.OnSuccess(getResponse, task.Close(writer))); err != nil {
common.Must(common.Interrupt(serverReader))
common.Must(common.Interrupt(serverWriter))
return errors.New("fallback ends").Base(err).AtInfo()
}
return nil
}
View on GitHub (pinned to 7d214f8b09)
Solutions
- No action needed if fallback responses are being served in general
- If responses never reach clients, verify TLS certificates on the fallback path match the SNI clients send
- Correlate with the Base error to confirm it is a client-side write failure
Defensive patterns
Strategy: try-catch
Try / catch
if err := buf.Copy(serverReader, writer, buf.UpdateActivity(timer)); err != nil {
// client vanished while the backend responded; end fallback quietly
return errors.New("failed to deliver response payload").Base(err).AtInfo()
} Prevention
- Treat as expected behavior for prober clients with short timeouts
- Ensure fallback TLS certificates match served SNI so clients do not abort mid-response
- No remediation beyond the backend health practices in [730]/[731]
When it happens
Trigger: Client TLS connection resets while the backend is still responding, or the context is cancelled by the inactivity timer during the UplinkOnly window.
Common situations: Prober timeouts, client closing on large error pages, mobile network churn.
Related errors
- failed to fallback request payload
- Trojan fallbacks: "path" must be empty or start with "/"
- Trojan fallbacks: please fill in a valid value for every "de
- Trojan fallbacks: invalid PROXY protocol version, "xver" onl
- unexpected EOF
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/ed932c47cbd6c350.
Report an issue: GitHub.