{"record":{"id":"675fabd9ecd0944b","repo":"aeron-io/aeron","slug":"invalid-maxresend-maxresend-must-be-0-and-max-resend-max","errorCode":null,"errorMessage":"invalid maxResend=<maxResend>, must be > 0 and <= <MAX_RESEND_MAX>","messagePattern":"invalid maxResend=<maxResend>, must be > 0 and <= <MAX_RESEND_MAX>","errorType":"validation","errorClass":"InvalidChannelException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/PublicationParams.java","lineNumber":535,"sourceCode":"        untetheredRestingTimeoutNs = getTimeoutNs(\n            channelUri, UNTETHERED_RESTING_TIMEOUT_PARAM_NAME, ctx.untetheredRestingTimeoutNs());\n    }\n\n    private void getMaxResend(final ChannelUri channelUri, final MediaDriver.Context ctx)\n    {\n        final String maxRetransmtsString = channelUri.get(MAX_RESEND_PARAM_NAME);\n\n        if (maxRetransmtsString == null)\n        {\n            maxResend = ctx.maxResend();\n        }\n        else\n        {\n            maxResend = parseInt(maxRetransmtsString, MAX_RESEND_PARAM_NAME);\n\n            if (maxResend <= 0 || maxResend > Configuration.MAX_RESEND_MAX)\n            {\n                throw new InvalidChannelException(\n                    \"invalid \" + MAX_RESEND_PARAM_NAME + \"=\" + maxResend +\n                    \", must be > 0 and <= \" + Configuration.MAX_RESEND_MAX);\n            }\n        }\n    }\n\n    private static int parseInt(final String value, final String paramName)\n    {\n        try\n        {\n            return Integer.parseInt(value);\n        }\n        catch (final NumberFormatException ex)\n        {\n            throw new InvalidChannelException(\n                \"invalid \" + paramName + \", must be a number\", ex);\n        }\n    }","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/PublicationParams.java#L517-L553","documentation":"The `max-resend` channel URI parameter was parsed but is outside the allowed range: it must be greater than 0 and at most Configuration.MAX_RESEND_MAX. Aeron throws InvalidChannelException because the value controls how many resends may be outstanding and an out-of-range value is unsafe.","triggerScenarios":"Adding a publication with a channel URI containing `max-resend=0`, a negative value, or a value exceeding Configuration.MAX_RESEND_MAX (e.g. max-resend=100).","commonSituations":"Misreading the parameter semantics (setting 0 thinking 'no resends'); copying a value from docs for a different Aeron version where the cap differed; config templating generating bad values.","solutions":["Set max-resend to a positive value within the documented cap (check Configuration.MAX_RESEND_MAX for your Aeron version)","Remove the max-resend parameter to use the driver default","Clamp the value in code before building the URI: Math.max(1, Math.min(value, MAX_RESEND_MAX))","If you want to disable resends, this param is not the mechanism — review the loss-control docs"],"exampleFix":"// before\n\"aeron:udp?endpoint=localhost:40456|max-resend=0\"\n// after\n\"aeron:udp?endpoint=localhost:40456|max-resend=6\"","handlingStrategy":"validation","validationCode":"int maxResend = configuredMaxResend;\nif (maxResend <= 0 || maxResend > io.aeron.driver.Configuration.MAX_RESEND_MAX)\n    throw new IllegalArgumentException(\"max-resend must be > 0 and <= \" + Configuration.MAX_RESEND_MAX);","typeGuard":null,"tryCatchPattern":"try { publication = aeron.addPublication(uri, streamId); }\ncatch (InvalidChannelException e) {\n    if (e.getMessage().contains(\"invalid max-resend\")) {\n        throw new ConfigurationException(\"Clamp max-resend to [1, MAX_RESEND_MAX]\", e);\n    } throw e;\n}","preventionTips":["Clamp config values to the documented range at load time","Do not assume MAX_RESEND_MAX across Aeron versions — read Configuration","Never encode 'off' as 0 for this parameter"],"tags":["aeron","channel-uri","validation","max-resend"],"backgroundTag":"value-out-of-range","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"}