{"record":{"id":"af4582bc995829c3","repo":"eclipse-vertx/vert.x","slug":"maxpoolsize-must-be-0","errorCode":null,"errorMessage":"maxPoolSize must be > 0","messagePattern":"maxPoolSize must be > 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/PoolOptions.java","lineNumber":134,"sourceCode":"\n  /**\n   * Get the maximum pool size for HTTP/1.x connections\n   *\n   * @return  the maximum pool size\n   */\n  public int getHttp1MaxSize() {\n    return http1MaxSize;\n  }\n\n  /**\n   * Set the maximum pool size for HTTP/1.x connections\n   *\n   * @param http1MaxSize  the maximum pool size\n   * @return a reference to this, so the API can be used fluently\n   */\n  public PoolOptions setHttp1MaxSize(int http1MaxSize) {\n    if (http1MaxSize < 1) {\n      throw new IllegalArgumentException(\"maxPoolSize must be > 0\");\n    }\n    this.http1MaxSize = http1MaxSize;\n    return this;\n  }\n\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","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/PoolOptions.java#L116-L152","documentation":"PoolOptions.setHttp1MaxSize() enforces that the HTTP/1.x connection pool max size is at least 1. Passing a value of 0 or negative throws this IllegalArgumentException because a pool that admits no connections is invalid.","triggerScenarios":"Calling setHttp1MaxSize(0) (or a negative value) directly, or via PoolOptions.fromJson with an \"http1MaxSize\" entry <= 0, e.g. loading client options from config JSON where maxPoolSize was set to 0.","commonSituations":"Externalized configuration where someone disabled pooling by setting the size to 0; computed pool sizes that floor to 0; copied Vert.x 3 options where 0 or negative sometimes meant 'unbounded'.","solutions":["Set http1MaxSize to a positive integer (>= 1); use the default (e.g. 5) if unsure.","Sanitize config-loaded values: coerce <= 0 to the default before calling fromJson/setHttp1MaxSize.","To limit connections, use a value like 1 rather than 0."],"exampleFix":"// before\nnew PoolOptions().setHttp1MaxSize(0);\n// after\nnew PoolOptions().setHttp1MaxSize(5); // any value >= 1","handlingStrategy":"validation","validationCode":"int size = parseSize(cfg.getString(\"http1MaxSize\", \"5\"));\nif (size < 1) throw new IllegalArgumentException(\"http1MaxSize must be >= 1\");\nnew PoolOptions().setHttp1MaxSize(size);","typeGuard":"boolean validPoolSize(Integer v) { return v != null && v >= 1; }","tryCatchPattern":"try { poolOptions.setHttp1MaxSize(size); } catch (IllegalArgumentException e) { log.error(\"Bad http1MaxSize config\", e); }","preventionTips":["Validate external config before fromJson.","Remember 0/negative is invalid — never use 0 to 'disable' pooling.","Prefer documented defaults over hand-computed sizes."],"tags":["http","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-14T05:17:10.506Z"}