{"record":{"id":"bfe244600490d29c","repo":"eclipse-vertx/vert.x","slug":"invalid-window-size-windowsize","errorCode":null,"errorMessage":"Invalid window size: ${windowSize}","messagePattern":"Invalid window size: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/impl/http2/codec/Http2ConnectionImpl.java","lineNumber":321,"sourceCode":"      data = safeBuffer(data);\n      Buffer buff = BufferInternal.buffer(data);\n      stream.onData(buff);\n      if (endOfStream) {\n        stream.onTrailers();\n      }\n    }\n    return padding;\n  }\n\n  @Override\n  public int getWindowSize() {\n    return windowSize;\n  }\n\n  @Override\n  public HttpConnection setWindowSize(int windowSize) {\n    if (windowSize <= 0) {\n      throw new IllegalArgumentException(\"Invalid window size: \" + windowSize);\n    }\n    try {\n      io.netty.handler.codec.http2.Http2Stream stream = handler.encoder().connection().connectionStream();\n      int delta = windowSize - this.windowSize;\n      handler.decoder().flowController().incrementWindowSize(stream, delta);\n      this.windowSize = windowSize;\n      return this;\n    } catch (Http2Exception e) {\n      throw new VertxException(e);\n    }\n  }\n\n  @Override\n  public HttpVersion protocolVersion() {\n    return HttpVersion.HTTP_2;\n  }\n\n  @Override","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/impl/http2/codec/Http2ConnectionImpl.java#L303-L339","documentation":"HttpConnection.setWindowSize on the standard HTTP/2 connection implementation rejects window sizes <= 0. The connection-level flow-control window must be a positive number of bytes; Vert.x validates before computing the delta to apply to Netty's flow controller.","triggerScenarios":"Calling connection.setWindowSize(0) or a negative value, often from a user-supplied config value for the HTTP/2 connection window.","commonSituations":"Config files where the window size is 0 ('disabled' intended) or a negative default; parsing settings from environment variables without validation; confusing window size with increment semantics.","solutions":["Pass a positive int, e.g. setWindowSize(65535) or larger for high-throughput servers.","Validate configuration before applying: if (configured <= 0) use a sane default like 65535.","Remember this sets an absolute window size, not an increment; compute the desired total first."],"exampleFix":"// before\nconn.setWindowSize(config.getWindowSize()); // may be 0\n// after\nint ws = config.getWindowSize() > 0 ? config.getWindowSize() : 65535;\nconn.setWindowSize(ws);","handlingStrategy":"validation","validationCode":"if (windowSize <= 0) throw new IllegalArgumentException(\"windowSize must be > 0\");","typeGuard":"boolean validWindowSize(int ws) { return ws > 0; }","tryCatchPattern":"try { conn.setWindowSize(ws); } catch (IllegalArgumentException e) { conn.setWindowSize(65535); }","preventionTips":["Validate window-size configuration at startup","Use positive defaults (e.g. 65535)","Don't use 0 to mean 'unlimited' for HTTP/2 windows","Document config units (bytes) for operators"],"tags":["http2","flow-control","window-size","argument-validation"],"backgroundTag":"invalid-argument-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"}