{"record":{"id":"318b73dc2d835aa8","repo":"XTLS/Xray-core","slug":"failed-to-transport-all-udp-response-318b73","errorCode":null,"errorMessage":"failed to transport all UDP response","messagePattern":"failed to transport all UDP response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"proxy/shadowsocks/client.go","lineNumber":181,"sourceCode":"\t\t\t\tRequest: request,\n\t\t\t}\n\n\t\t\tif err := buf.Copy(link.Reader, writer, buf.UpdateActivity(timer)); err != nil {\n\t\t\t\treturn errors.New(\"failed to transport all UDP request\").Base(err)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tresponseDone := func() error {\n\t\t\tdefer timer.SetTimeout(sessionPolicy.Timeouts.UplinkOnly)\n\n\t\t\treader := &UDPReader{\n\t\t\t\tReader: conn,\n\t\t\t\tUser:   user,\n\t\t\t}\n\n\t\t\tif err := buf.Copy(reader, link.Writer, buf.UpdateActivity(timer)); err != nil {\n\t\t\t\treturn errors.New(\"failed to transport all UDP response\").Base(err)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tresponseDoneAndCloseWriter := task.OnSuccess(responseDone, task.Close(link.Writer))\n\t\tif err := task.Run(ctx, requestDone, responseDoneAndCloseWriter); err != nil {\n\t\t\treturn errors.New(\"connection ends\").Base(err)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\treturn nil\n}\n\nfunc init() {\n\tcommon.Must(common.RegisterConfig((*ClientConfig)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {\n\t\treturn NewClient(ctx, config.(*ClientConfig))","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/shadowsocks/client.go#L163-L199","documentation":"Thrown when relaying the Shadowsocks server's UDP responses back to the client (UDPReader → link.Writer) fails. UDPReader must decrypt and parse each framed packet; a decrypt failure, malformed packet, or closed inbound writer surfaces here. Frequently paired with [623]; both sharing a cause indicates a broken UDP path, while this one alone suggests a server-side or parsing problem.","triggerScenarios":"buf.Copy from UDPReader to link.Writer returns an error: AEAD decryption of a response packet fails (key/nonce desync), packet framing from the server is malformed, or the client-side link writer was closed.","commonSituations":"Server and client cipher/password mismatch that only manifests on responses; server implementation sending non-2022 framing to a 2022-aware client; concurrent reuse of one UDP session by multiple destinations after a server restart.","solutions":["Verify password, method, and (for 2022) PSK identity match on both ends — response decrypt failure is the classic mismatch symptom.","Restart the client session (or Xray) so client and server nonce/counters resynchronize.","Check whether the server restarted mid-session; stale sessions cannot decrypt new-server responses.","If persistent, capture one failing exchange and compare with a known-good client implementation."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := buf.Copy(reader, link.Writer, buf.UpdateActivity(timer)); err != nil {\n  if errors.Is(err, context.Canceled) || errors.Is(err, io.EOF) {\n    return nil\n  }\n  return errors.New(\"failed to transport all UDP response\").Base(err)\n}","preventionTips":["Restart sessions (or Xray) after server restarts to resync AEAD counters.","Keep credentials in sync via config management instead of manual edits.","Alert on repeated decrypt failures — they signal key drift, not network noise."],"tags":["shadowsocks","network","udp","decryption","relay"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}