{"record":{"id":"1d6f66494303defb","repo":"eclipse-vertx/vert.x","slug":"http-1-x-connections-don-t-support-goaway","errorCode":null,"errorMessage":"HTTP/1.x connections don't support GOAWAY","messagePattern":"HTTP/1\\.x connections don't support GOAWAY","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/http/impl/http1/Http1Connection.java","lineNumber":107,"sourceCode":"\n  @Override\n  public Http1Connection closeHandler(Handler<Void> handler) {\n    return (Http1Connection) super.closeHandler(handler);\n  }\n\n  @Override\n  public HttpVersion protocolVersion() {\n    return HttpVersion.HTTP_1_1;\n  }\n\n  @Override\n  public Http1Connection exceptionHandler(Handler<Throwable> handler) {\n    return (Http1Connection) super.exceptionHandler(handler);\n  }\n\n  @Override\n  public HttpConnection goAway(long errorCode, int lastStreamId, Buffer debugData) {\n    throw new UnsupportedOperationException(\"HTTP/1.x connections don't support GOAWAY\");\n  }\n\n  @Override\n  public HttpConnection goAwayHandler(@Nullable Handler<GoAway> handler) {\n    throw new UnsupportedOperationException(\"HTTP/1.x connections don't support GOAWAY\");\n  }\n\n  @Override\n  public Http2Settings settings() {\n    throw new UnsupportedOperationException(\"HTTP/1.x connections don't support SETTINGS\");\n  }\n\n  @Override\n  public Future<Void> updateSettings(HttpSettings settings) {\n    throw new UnsupportedOperationException(\"HTTP/1.x connections don't support SETTINGS\");\n  }\n\n  @Override","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/http/impl/http1/Http1Connection.java#L89-L125","documentation":"Http1Connection.goAway(long, int, Buffer) throws UnsupportedOperationException because GOAWAY is an HTTP/2-only connection-management frame; HTTP/1.x has no equivalent. Vert.x implements the shared HttpConnection API for both protocols, and HTTP/1.x versions of HTTP/2-specific operations hard-fail.","triggerScenarios":"Calling connection.goAway(errorCode, lastStreamId, debugData) on an HttpConnection obtained from an HTTP/1.x request/response or HTTP/1.x client connection.","commonSituations":"Generic connection-drain/shutdown code written for HTTP/2 servers being reused on HTTP/1 endpoints; protocol negotiation falling back to HTTP/1.1 while code still calls GOAWAY to shed load.","solutions":["Guard with a protocol check (e.g. connection instanceof Http2Connection / check negotiated version) before calling goAway","For HTTP/1.x graceful shutdown, close the connection (connection.close()) or stop accepting new requests instead of sending GOAWAY","Route the connection to the HTTP/2 path (enable h2/ALPN) if GOAWAY semantics are actually required"],"exampleFix":"// before\nconnection.goAway(0, 0, Buffer.buffer(\"bye\")); // UnsupportedOperationException on HTTP/1.x\n// after\nif (connection instanceof Http2Connection) {\n  ((Http2Connection) connection).goAway(0, 0, Buffer.buffer(\"bye\"));\n} else {\n  connection.close(); // HTTP/1.x: no GOAWAY equivalent\n}","handlingStrategy":"type-guard","validationCode":"if (!(connection instanceof Http2Connection)) {\n  // HTTP/1.x: cannot goAway; plan close() instead\n}","typeGuard":"boolean supportsGoAway(HttpConnection c) {\n  return c instanceof Http2Connection;\n}","tryCatchPattern":"try {\n  connection.goAway(0, 0, debugData);\n} catch (UnsupportedOperationException e) {\n  connection.close(); // HTTP/1.x fallback\n}","preventionTips":["Branch on connection type (Http2Connection) before GOAWAY/shutdown logic","Use closeHandler for HTTP/1.x lifecycle instead of GOAWAY events","Enable HTTP/2 if graceful draining semantics are needed"],"tags":["http1","http2","goaway","unsupported"],"backgroundTag":"unsupported-operation","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"}