XTLS/Xray-core · info
failed to deliver response payload
Error message
failed to deliver response payload
What it means
Raised in the trojan fallback path's response pump when buf.Copy from the fallback upstream to the connection writer failed; the chained error means delivering the fallback response to the client ended abnormally.
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
- connection ends
- failed to dial to
- failed to find the default "alpn" config
- failed to find the default "name" config
AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15).
Data as JSON: /api/errors/ed932c47cbd6c350.
Report an issue: GitHub.
Appendix: 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)