{"record":{"id":"0f690496bc4cae9d","repo":"eclipse-vertx/vert.x","slug":"http2maxpoolsize-must-be-0","errorCode":null,"errorMessage":"http2MaxPoolSize must be > 0","messagePattern":"http2MaxPoolSize must be > 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/PoolOptions.java","lineNumber":157,"sourceCode":"\n  /**\n   * Get the maximum pool size for HTTP/2 connections\n   *\n   * @return  the maximum pool size\n   */\n  public int getHttp2MaxSize() {\n    return http2MaxSize;\n  }\n\n  /**\n   * Set the maximum pool size for HTTP/2 connections\n   *\n   * @param max  the maximum pool size\n   * @return a reference to this, so the API can be used fluently\n   */\n  public PoolOptions setHttp2MaxSize(int max) {\n    if (max < 1) {\n      throw new IllegalArgumentException(\"http2MaxPoolSize must be > 0\");\n    }\n    this.http2MaxSize = max;\n    return this;\n  }\n\n  /**\n   * Get the maximum pool size for HTTP/3 connections\n   *\n   * @return  the maximum pool size\n   */\n  public int getHttp3MaxSize() {\n    return http3MaxSize;\n  }\n\n  /**\n   * Set the maximum pool size for HTTP/3 connections\n   *\n   * @param max  the maximum pool size","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/PoolOptions.java#L139-L175","documentation":"PoolOptions.setHttp2MaxSize() enforces that the HTTP/2 connection pool max size is at least 1. Values of 0 or less throw this IllegalArgumentException because the pool must be able to hold at least one connection.","triggerScenarios":"Calling setHttp2MaxSize(0) or negative, or PoolOptions.fromJson with an \"http2MaxSize\" JSON entry <= 0, e.g. loading HttpClientOptions-derived pool config where the HTTP/2 pool size was set to 0.","commonSituations":"Config files tuned for HTTP/1.1 applied to HTTP/2 clients with a zeroed http2MaxSize; dynamic config generators emitting 0 as a 'disabled' sentinel.","solutions":["Provide a positive integer for http2MaxSize (>= 1).","Validate/clamp JSON config values before PoolOptions.fromJson.","If multiplexing means you only need one connection, set the value to 1."],"exampleFix":"// before\noptions.put(\"http2MaxSize\", 0);\nnew PoolOptions().fromJson(options);\n// after\noptions.put(\"http2MaxSize\", 1); // >= 1\nnew PoolOptions().fromJson(options);","handlingStrategy":"validation","validationCode":"int size = json.getInteger(\"http2MaxSize\", io.vertx.core.http.PoolOptions.DEFAULT_HTTP2_MAX_SIZE);\nif (size < 1) size = io.vertx.core.http.PoolOptions.DEFAULT_HTTP2_MAX_SIZE;\nnew PoolOptions().setHttp2MaxSize(size);","typeGuard":"boolean validPoolSize(Integer v) { return v != null && v >= 1; }","tryCatchPattern":"try { poolOptions.setHttp2MaxSize(size); } catch (IllegalArgumentException e) { log.error(\"http2MaxSize must be >= 1\", e); }","preventionTips":["Clamp JSON-configured pool sizes to >= 1.","Don't reuse HTTP/1.1 config templates verbatim for HTTP/2 clients."],"tags":["http","http2","pool","configuration","validation"],"backgroundTag":"invalid-config-value","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"}