{"record":{"id":"8ce037b1f92577e1","repo":"eclipse-vertx/vert.x","slug":"http-keepalivetimeout-must-be-0","errorCode":null,"errorMessage":"HTTP keepAliveTimeout must be >= 0","messagePattern":"HTTP keepAliveTimeout must be >= 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/HttpClientConfig.java","lineNumber":215,"sourceCode":"   */\n  public HttpClientConfig setConnectTimeout(Duration connectTimeout) {\n    tcpConfig.setConnectTimeout(connectTimeout);\n    quicConfig.setConnectTimeout(connectTimeout);\n    return this;\n  }\n\n  /**\n   * <p>Set the keep alive timeout for HTTP 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   * <p>This configures each HTTP version with the same value, you can override this and configure each\n   * version separately.</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 HttpClientConfig setKeepAliveTimeout(Duration keepAliveTimeout) {\n    if (keepAliveTimeout != null && (keepAliveTimeout.isNegative())) {\n      throw new IllegalArgumentException(\"HTTP keepAliveTimeout must be >= 0\");\n    }\n    http1Config.setKeepAliveTimeout(keepAliveTimeout);\n    http2Config.setKeepAliveTimeout(keepAliveTimeout);\n    http3Config.setKeepAliveTimeout(keepAliveTimeout);\n    return this;\n  }\n\n  /**\n   * Set the idle timeout, zero or {@code null} means don't time out.\n   * This determines if a connection will timeout and be closed if no data is received nor sent within the timeout.\n   * <p>This configures both TCP and QUIC nested configurations, you can configure each of them separately\n   * if you need to.</p>\n   *\n   * @param idleTimeout  the timeout\n   * @return a reference to this, so the API can be used fluently\n   */\n  public HttpClientConfig setIdleTimeout(Duration idleTimeout) {\n    tcpConfig.setIdleTimeout(idleTimeout);","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/HttpClientConfig.java#L197-L233","documentation":"Configuration validation in HttpClientConfig.setKeepAliveTimeout: the Duration controlling how long an idle HTTP connection remains in the pool before eviction must be non-negative (zero or null disables eviction), and it is propagated to all per-version configs. Negative durations are rejected.","triggerScenarios":"Thrown at vertx-core/src/main/java/io/vertx/core/http/HttpClientConfig.java:215 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a zero or positive Duration (or null)","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"}