eclipse-vertx/vert.x · error · IllegalArgumentException

reconnect attempts must be >= -1

Error message

reconnect attempts must be >= -1

What it means

Configuration validation in QuicClientConfig.setReconnectAttempts: the maximum number of reconnect attempts must be >= -1, where -1 means unlimited retries and 0 means no reconnection. Values below -1 are rejected as meaningless.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/net/QuicClientConfig.java:178

    return this;
  }

  /**
   * @return  the value of reconnect attempts
   */
  public int getReconnectAttempts() {
    return reconnectAttempts;
  }

  /**
   * Set the value of reconnect attempts
   *
   * @param attempts  the maximum number of reconnect attempts
   * @return a reference to this, so the API can be used fluently
   */
  public QuicClientConfig setReconnectAttempts(int attempts) {
    if (attempts < -1) {
      throw new IllegalArgumentException("reconnect attempts must be >= -1");
    }
    this.reconnectAttempts = attempts;
    return this;
  }

  /**
   * @return  the value of reconnect interval
   */
  public Duration getReconnectInterval() {
    return reconnectInterval;
  }

  /**
   * Set the reconnect interval
   *
   * @param interval  the reconnect interval
   * @return a reference to this, so the API can be used fluently
   */

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Pass -1 (unlimited), 0 (none), or a positive attempt count
  2. Validate configuration values from external sources before applying
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/net/QuicClientConfig.java:178 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06). Data as JSON: /api/errors/96ba4783cc49192f. Report an issue: GitHub.