{"record":{"id":"43eea31a9d6153aa","repo":"eclipse-vertx/vert.x","slug":"unsupported-http-version-version","errorCode":null,"errorMessage":"Unsupported HTTP version: <version>","messagePattern":"Unsupported HTTP version: <version>","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/impl/HttpUtils.java","lineNumber":545,"sourceCode":"      }\n    }\n    if (buffer != null) {\n      return buffer.toString();\n    } else {\n      return sequence;\n    }\n  }\n\n  public static HttpVersion toNettyHttpVersion(io.vertx.core.http.HttpVersion version) {\n    switch (version) {\n      case HTTP_1_0: {\n        return HttpVersion.HTTP_1_0;\n      }\n      case HTTP_1_1: {\n        return HttpVersion.HTTP_1_1;\n      }\n      default:\n        throw new IllegalArgumentException(\"Unsupported HTTP version: \" + version);\n    }\n  }\n\n  static io.vertx.core.http.HttpMethod toVertxMethod(String method) {\n    return io.vertx.core.http.HttpMethod.valueOf(method);\n  }\n\n  private static final AsciiString TIMEOUT_EQ = AsciiString.of(\"timeout=\");\n\n  public static int parseKeepAliveHeaderTimeout(CharSequence value) {\n    int len = value.length();\n    int pos = 0;\n    while (pos < len) {\n      int idx = AsciiString.indexOf(value, ',', pos);\n      int next;\n      if (idx == -1) {\n        idx = next = len;\n      } else {","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/impl/HttpUtils.java#L527-L563","documentation":"HttpUtils.toNettyHttpVersion maps Vert.x HttpVersion enums (HTTP_1_0, HTTP_1_1) to Netty's HttpVersion; any other value falls into the default branch and throws IllegalArgumentException. This is an internal invariant: only HTTP/1.0 and HTTP/1.1 are convertible in this HTTP/1 path.","triggerScenarios":"Passing HttpVersion.HTTP_2 (or any other enum value) into a code path that calls toNettyHttpVersion, e.g. configuring an HTTP/1 client transport with HTTP_2, or custom pipeline code invoking the mapping with an unexpected version.","commonSituations":"Mixing HTTP/2 options with an HTTP/1-only client builder; version derived from untrusted input; version mismatches where new enum constants flow into old HTTP/1 mapping code.","solutions":["Ensure the HTTP version in options is HTTP_1_0 or HTTP_1_1 when using the HTTP/1 transport; use HTTP/2-specific APIs for HTTP_2","Check/normalize the version before invoking code that maps to Netty HTTP/1 versions","Upgrade Vert.x so HTTP_2 is routed through the correct transport path"],"exampleFix":"// before\nHttpClient client = vertx.createHttpClient(new HttpClientOptions().setProtocolVersion(HttpVersion.HTTP_2).setKeepAlive(true)); // wrong transport\n// after\nHttpClientOptions opts = version == HttpVersion.HTTP_2\n  ? new HttpClientOptions().setProtocolVersion(HttpVersion.HTTP_2).setHttp2ClearTextUpgrade(false)\n  : new HttpClientOptions().setProtocolVersion(version);\nHttpClient client = vertx.createHttpClient(opts);","handlingStrategy":"validation","validationCode":"if (version != HttpVersion.HTTP_1_0 && version != HttpVersion.HTTP_1_1) {\n  throw new IllegalArgumentException(\"HTTP/1 transport requires HTTP_1_0 or HTTP_1_1, got \" + version);\n}","typeGuard":null,"tryCatchPattern":"try {\n  client.request(new RequestOptions().setHttpVersion(version));\n} catch (IllegalArgumentException e) {\n  // fall back to HTTP/1.1 or use HTTP/2 client APIs\n}","preventionTips":["Match HttpClientOptions protocol version to the transport (HTTP_2 only via HTTP/2-capable client)","Validate version enum values before passing to HTTP/1 pipelines","Keep Vert.x dependencies on a consistent version"],"tags":["http","versioning","illegal-argument"],"backgroundTag":"invalid-enum-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"}