eclipse-vertx/vert.x · error · IllegalArgumentException

HTTP/2 keepAliveTimeout must be >= 0

Error message

HTTP/2 keepAliveTimeout must be >= 0

What it means

Configuration validation in Http2ClientConfig.setKeepAliveTimeout: the Duration controlling how long an idle HTTP/2 connection stays in the pool before eviction must be non-negative (zero or null disables eviction). A negative Duration is rejected by the setter.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/http/Http2ClientConfig.java:123

  }

  /**
   * @return the keep alive timeout value in seconds for HTTP/2 connections
   */
  public Duration getKeepAliveTimeout() {
    return keepAliveTimeout;
  }

  /**
   * <p>Set the keep alive timeout for HTTP/2 connections. This value determines how long a connection remains
   * unused in the pool before being evicted and closed. A timeout of zero or {@code null} means there is no timeout.</p>
   *
   * @param keepAliveTimeout the timeout, in seconds
   * @return a reference to this, so the API can be used fluently
   */
  public Http2ClientConfig setKeepAliveTimeout(Duration keepAliveTimeout) {
    if (keepAliveTimeout != null && (keepAliveTimeout.isNegative() || keepAliveTimeout.isZero())) {
      throw new IllegalArgumentException("HTTP/2 keepAliveTimeout must be >= 0");
    }
    this.keepAliveTimeout = keepAliveTimeout;
    return this;
  }

  /**
   * @return the HTTP/2 upgrade maximum length of the aggregated content in bytes
   */
  public int getUpgradeMaxContentLength() {
    return upgradeMaxContentLength;
  }

  /**
   * Set the HTTP/2 upgrade maximum length of the aggregated content in bytes.
   * This is only taken into account when {@link Http2ClientConfig#isClearTextUpgradeWithPreflightRequest} is set to {@code false} (which is the default).
   * When {@link Http2ClientConfig#isClearTextUpgradeWithPreflightRequest} is {@code true}, then the client makes a preflight OPTIONS request
   * and the upgrade will not send a body, voiding the requirements.
   *

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Use a zero or positive Duration (or null) for the timeout
  2. Validate Duration configuration parsed from external sources
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/http/Http2ClientConfig.java:123 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/ee9ca3765b38f28e. Report an issue: GitHub.