eclipse-vertx/vert.x · error · IllegalArgumentException

connectTimeout must be >= 0

Error message

connectTimeout must be >= 0

What it means

Configuration validation in ClientOptionsBase.setConnectTimeout: the TCP connect timeout in milliseconds must be non-negative (0 means no timeout). Negative timeouts are meaningless and rejected before the field is assigned.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/net/ClientOptionsBase.java:152

    return this;
  }

  /**
   * @return the value of connect timeout
   */
  public int getConnectTimeout() {
    return connectTimeout;
  }

  /**
   * Set the connect timeout
   *
   * @param connectTimeout  connect timeout, in ms
   * @return a reference to this, so the API can be used fluently
   */
  public ClientOptionsBase setConnectTimeout(int connectTimeout) {
    if (connectTimeout < 0) {
      throw new IllegalArgumentException("connectTimeout must be >= 0");
    }
    this.connectTimeout = connectTimeout;
    return this;
  }

  /**
   * @return the metrics name identifying the reported metrics.
   */
  public String getMetricsName() {
    return metricsName;
  }

  /**
   * Set the metrics name identifying the reported metrics, useful for grouping metrics
   * with the same name.
   *
   * @param metricsName the metrics name
   * @return a reference to this, so the API can be used fluently

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Pass a value >= 0 (0 disables the timeout)
  2. Validate configuration deserialized from JSON before applying
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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