{"record":{"id":"149441fe8d6f4061","repo":"aeron-io/aeron","slug":"failed-to-send-byte-packet-to","errorCode":null,"errorMessage":"failed to send  byte packet to ","messagePattern":"failed to send  byte packet to ","errorType":"exception","errorClass":"AeronException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/media/UdpChannelTransport.java","lineNumber":179,"sourceCode":"            portManager,\n            context,\n            udpChannel.socketRcvbufLengthOrDefault(context.socketRcvbufLength()),\n            udpChannel.socketSndbufLengthOrDefault(context.socketSndbufLength()));\n    }\n\n    /**\n     * Throw a {@link AeronException} with a message for a send error.\n     *\n     * @param bytesToSend expected to be sent to the network.\n     * @param ex          experienced.\n     * @param destination to which the send operation was addressed.\n     * @see #onSendError(IOException, InetSocketAddress, ErrorHandler)\n     * @deprecated {@link #onSendError(IOException, InetSocketAddress, ErrorHandler)} is used instead.\n     */\n    @Deprecated(forRemoval = true, since = \"1.46.6\")\n    public static void sendError(final int bytesToSend, final IOException ex, final InetSocketAddress destination)\n    {\n        throw new AeronException(\n            \"failed to send \" + bytesToSend + \" byte packet to \" + destination, ex, AeronException.Category.WARN);\n    }\n\n    /**\n     * Report an {@link AeronEvent} with a message for a send error.\n     *\n     * @param ex           experienced.\n     * @param destination  to which the send operation was addressed.\n     * @param errorHandler to report error to.\n     */\n    public static void onSendError(\n        final IOException ex, final InetSocketAddress destination, final ErrorHandler errorHandler)\n    {\n        errorHandler.onError(new AeronEvent(\n            \"failed to send datagram to \" + destination + \", cause: \" + ex, AeronException.Category.WARN));\n    }\n\n    /**","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/media/UdpChannelTransport.java#L161-L197","documentation":"Deprecated static hook sendError in UdpChannelTransport now unconditionally throws AeronException (WARN category) to force migration to the onSendError(IOException, InetSocketAddress, ErrorHandler) API. Any code still calling sendError fails instead of just reporting the send failure.","triggerScenarios":"Calling the static UdpChannelTransport.sendError(bytesToSend, ex, destination) method directly, typically from custom transport/destination code that has not migrated to onSendError; since 1.46.6 this throws regardless of arguments.","commonSituations":"Upgrading Aeron past 1.46.6 with custom send-error reporting code, IDE auto-completion picking the deprecated overload, or copy-pasted older samples.","solutions":["Replace calls to UdpChannelTransport.sendError(...) with UdpChannelTransport.onSendError(ex, destination, errorHandler).","Pass your ErrorHandler instance so the failure is reported as an AeronEvent instead of thrown.","Recompile and fix the resulting deprecation warnings after upgrading to >= 1.46.6."],"exampleFix":"// before\nUdpChannelTransport.sendError(bytes, ex, destination);\n// after\nUdpChannelTransport.onSendError(ex, destination, errorHandler);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Do not call the deprecated method at all; migrate:\ntry {\n    send(...);\n} catch (IOException ex) {\n    UdpChannelTransport.onSendError(ex, destination, errorHandler);\n}","preventionTips":["Treat deprecation warnings as build errors (-Werror)","Update integration code when upgrading past 1.46.6","Grep codebase for sendError( usages after upgrades"],"tags":["deprecated","api-migration","udp","send"],"backgroundTag":"deprecated-api-usage","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}