{"record":{"id":"2a3ec134dae97a85","repo":"eclipse-vertx/vert.x","slug":"you-must-set-at-least-one-supported-http-version","errorCode":null,"errorMessage":"You must set at least one supported HTTP version","messagePattern":"You must set at least one supported HTTP version","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/impl/HttpServerBuilderImpl.java","lineNumber":94,"sourceCode":"    boolean useQuic = config.getVersions().contains(HttpVersion.HTTP_3);\n    if (useQuic && sslOptions == null) {\n      throw new NullPointerException(\"SSL configuration is necessary for a QUIC server\");\n    }\n    HttpServer server;\n    if (useTcp) {\n      if (useQuic) {\n        HybridHttpServer compositeServer = new HybridHttpServer(vertx, new HttpServerConfig(config), sslOptions.copy(), sslEngineOptions);\n        server = new CleanableHttpServer(vertx, compositeServer);\n      } else {\n        if (sslOptions != null) {\n          sslOptions = sslOptions.copy();\n        }\n        server = new CleanableHttpServer(vertx, new TcpHttpServer(vertx, new HttpServerConfig(config), sslOptions, sslEngineOptions, null, registerWebSocketWriteHandlers));\n      }\n    } else if (useQuic) {\n      server = new CleanableHttpServer(vertx, new QuicHttpServer(vertx, new HttpServerConfig(config), sslOptions.copy(), null));\n    } else {\n      throw new IllegalArgumentException(\"You must set at least one supported HTTP version\");\n    }\n    Handler<HttpConnection> handler = connectHandler;\n    if (handler != null) {\n      return server.connectionHandler(handler);\n    }\n    return server;\n  }\n}\n","sourceCodeStart":76,"sourceCodeEnd":103,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/impl/HttpServerBuilderImpl.java#L76-L103","documentation":"HttpServerBuilderImpl.build() throws this IllegalArgumentException when the builder's version configuration contains none of the supported HTTP versions (HTTP/1.0, HTTP/1.1, HTTP/2 or HTTP/3), so no transport (TCP or QUIC) can be selected for the server.","triggerScenarios":"Building an HttpServer without ever calling addVersion(...), or after configuring only an unsupported/empty version set on the HttpServerConfig.","commonSituations":"Programmatic config assembled from flags/env where all version flags are false; forgetting to call addVersion because older Vert.x APIs defaulted to HTTP/1.1 automatically.","solutions":["Call addVersion(HttpVersion.HTTP_1_1, port) (or the desired version) on the builder before build()","Fix the configuration source so at least one HTTP version flag is true","Add a build-time validation that at least one version is configured before constructing the server"],"exampleFix":"// before\nHttpServer server = vertx.createHttpServer_builder()\n  .setPort(8080)\n  .build(); // no version set -> throws\n// after\nHttpServer server = vertx.createHttpServer_builder()\n  .addVersion(HttpVersion.HTTP_1_1, 8080)\n  .build();","handlingStrategy":"validation","validationCode":"if (versions.isEmpty() || versions.stream().noneMatch(v -> v == HttpVersion.HTTP_1_0 || v == HttpVersion.HTTP_1_1 || v == HttpVersion.HTTP_2 || v == HttpVersion.HTTP_3)) {\n  throw new IllegalArgumentException(\"configure at least one HTTP version via addVersion\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  server = builder.build();\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"at least one supported HTTP version\")) {\n    builder.addVersion(HttpVersion.HTTP_1_1, port);\n    server = builder.build();\n  } else { throw e; }\n}","preventionTips":["Always call addVersion at least once on the server builder","Validate version flags from config/env before building","Add a startup smoke test that builds the server configuration"],"tags":["server","config","http-versions","builder"],"backgroundTag":"missing-required-config","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"}