{"record":{"id":"ee9ca3765b38f28e","repo":"eclipse-vertx/vert.x","slug":"http-2-keepalivetimeout-must-be-0","errorCode":null,"errorMessage":"HTTP/2 keepAliveTimeout must be >= 0","messagePattern":"HTTP/2 keepAliveTimeout must be >= 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/Http2ClientConfig.java","lineNumber":123,"sourceCode":"  }\n\n  /**\n   * @return the keep alive timeout value in seconds for HTTP/2 connections\n   */\n  public Duration getKeepAliveTimeout() {\n    return keepAliveTimeout;\n  }\n\n  /**\n   * <p>Set the keep alive timeout for HTTP/2 connections. This value determines how long a connection remains\n   * unused in the pool before being evicted and closed. A timeout of zero or {@code null} means there is no timeout.</p>\n   *\n   * @param keepAliveTimeout the timeout, in seconds\n   * @return a reference to this, so the API can be used fluently\n   */\n  public Http2ClientConfig setKeepAliveTimeout(Duration keepAliveTimeout) {\n    if (keepAliveTimeout != null && (keepAliveTimeout.isNegative() || keepAliveTimeout.isZero())) {\n      throw new IllegalArgumentException(\"HTTP/2 keepAliveTimeout must be >= 0\");\n    }\n    this.keepAliveTimeout = keepAliveTimeout;\n    return this;\n  }\n\n  /**\n   * @return the HTTP/2 upgrade maximum length of the aggregated content in bytes\n   */\n  public int getUpgradeMaxContentLength() {\n    return upgradeMaxContentLength;\n  }\n\n  /**\n   * Set the HTTP/2 upgrade maximum length of the aggregated content in bytes.\n   * This is only taken into account when {@link Http2ClientConfig#isClearTextUpgradeWithPreflightRequest} is set to {@code false} (which is the default).\n   * When {@link Http2ClientConfig#isClearTextUpgradeWithPreflightRequest} is {@code true}, then the client makes a preflight OPTIONS request\n   * and the upgrade will not send a body, voiding the requirements.\n   *","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/Http2ClientConfig.java#L105-L141","documentation":"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.","triggerScenarios":"Thrown at vertx-core/src/main/java/io/vertx/core/http/Http2ClientConfig.java:123 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a zero or positive Duration (or null) for the timeout","Validate Duration configuration parsed from external sources"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}