aeron-io/aeron · error · IllegalArgumentException

must be a number

Error message

${MAX_RESEND_PARAM_NAME} must be a number

What it means

Thrown when the max_resend channel URI parameter cannot be parsed as an integer. ChannelUriStringBuilder expects max_resend (max number of retransmit actions) to be a plain integer; any other string raises this IllegalArgumentException, with the original NumberFormatException as the cause.

Solutions

  1. Set max_resend to a plain integer literal, e.g. max_resend=8.
  2. Trim the value and remove any whitespace, units, or comments before URI parsing.
  3. Validate the parameter with Integer.parseInt in your config layer and fall back to the default when absent.

Example fix

// before
String uri = "aeron:udp?endpoint=localhost:40456|max_resend=unlimited";
// after
String uri = "aeron:udp?endpoint=localhost:40456|max_resend=8";
Defensive patterns

Strategy: validation

Validate before calling

int parseMaxResend(String value) {
    try {
        return Integer.parseInt(value.trim());
    } catch (NumberFormatException e) {
        throw new IllegalArgumentException("max_resend must be an integer, got: '" + value + "'", e);
    }
}

Type guard

boolean isValidMaxResend(String value) {
    try {
        Integer.parseInt(value.trim());
        return true;
    } catch (NumberFormatException e) {
        return false;
    }
}

Try / catch

try {
    builder.maxResend(Integer.parseInt(valueStr));
} catch (NumberFormatException e) {
    log.warn("max_resend '{}' not a number, using default", valueStr);
    // omit the parameter
}

Prevention

When it happens

Trigger: Building/parsing a channel URI containing max_resend=<non-integer>, e.g. max_resend=3.5, max_resend=unlimited, or an empty value via ChannelUriStringBuilder.

Common situations: Writing 'unlimited' or 'default' instead of a number; float values where an int was expected; empty value after config substitution; whitespace around the number.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of aeron-io/aeron@6d60124e15 (2026-09-12). Data as JSON: /api/errors/ef205a5a7b26c211. Report an issue: GitHub.

Appendix: source

Thrown at aeron-client/src/main/java/io/aeron/ChannelUriStringBuilder.java:2327

     * @see CommonContext#MAX_RESEND_PARAM_NAME
     */
    public ChannelUriStringBuilder maxResend(final ChannelUri channelUri)
    {
        final String valueStr = channelUri.get(MAX_RESEND_PARAM_NAME);
        if (null == valueStr)
        {
            this.maxResend = null;
            return this;
        }
        else
        {
            try
            {
                return maxResend(Integer.parseInt(valueStr));
            }
            catch (final NumberFormatException ex)
            {
                throw new IllegalArgumentException(MAX_RESEND_PARAM_NAME + " must be a number", ex);
            }
        }
    }

    /**
     * The max number of retransmit actions.
     *
     * @return the max number of outstanding retransmit actions
     * @see CommonContext#MAX_RESEND_PARAM_NAME
     */
    public Integer maxResend()
    {
        return maxResend;
    }

    /**
     * The stream id of the channel.
     *

View on GitHub (pinned to 6d60124e15)