aeron-io/aeron · error · InvalidChannelException
invalid maxResend= , must be > 0 and <=
Error message
invalid maxResend=<maxResend>, must be > 0 and <= <MAX_RESEND_MAX>
What it means
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.
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
Example fix
// before "aeron:udp?endpoint=localhost:40456|max-resend=0" // after "aeron:udp?endpoint=localhost:40456|max-resend=6"
Defensive patterns
Strategy: validation
Validate before calling
int maxResend = configuredMaxResend;
if (maxResend <= 0 || maxResend > io.aeron.driver.Configuration.MAX_RESEND_MAX)
throw new IllegalArgumentException("max-resend must be > 0 and <= " + Configuration.MAX_RESEND_MAX); Try / catch
try { publication = aeron.addPublication(uri, streamId); }
catch (InvalidChannelException e) {
if (e.getMessage().contains("invalid max-resend")) {
throw new ConfigurationException("Clamp max-resend to [1, MAX_RESEND_MAX]", e);
} throw e;
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- destinations must not contain the key
- difference greater than 2^31 - 1: termId=
- invalid control mode
- invalid media
- invalid , must be a number
AI-assisted analysis of aeron-io/aeron@6d60124e15 (2026-09-12).
Data as JSON: /api/errors/675fabd9ecd0944b.
Report an issue: GitHub.
Appendix: source
Thrown at aeron-driver/src/main/java/io/aeron/driver/PublicationParams.java:535
untetheredRestingTimeoutNs = getTimeoutNs(
channelUri, UNTETHERED_RESTING_TIMEOUT_PARAM_NAME, ctx.untetheredRestingTimeoutNs());
}
private void getMaxResend(final ChannelUri channelUri, final MediaDriver.Context ctx)
{
final String maxRetransmtsString = channelUri.get(MAX_RESEND_PARAM_NAME);
if (maxRetransmtsString == null)
{
maxResend = ctx.maxResend();
}
else
{
maxResend = parseInt(maxRetransmtsString, MAX_RESEND_PARAM_NAME);
if (maxResend <= 0 || maxResend > Configuration.MAX_RESEND_MAX)
{
throw new InvalidChannelException(
"invalid " + MAX_RESEND_PARAM_NAME + "=" + maxResend +
", must be > 0 and <= " + Configuration.MAX_RESEND_MAX);
}
}
}
private static int parseInt(final String value, final String paramName)
{
try
{
return Integer.parseInt(value);
}
catch (final NumberFormatException ex)
{
throw new InvalidChannelException(
"invalid " + paramName + ", must be a number", ex);
}
}View on GitHub (pinned to 6d60124e15)