eclipse-vertx/vert.x · error · IllegalStateException

Not connected

Error message

Not connected

What it means

Lifecycle guard in ClientWebSocketImpl.delegate: the client WebSocket's internal connection (ws) is null, meaning the socket is not connected yet (or has been closed). Any delegate-requiring operation (write, pause, fetch, handlers, ...) invoked before the connection is established fails with this generic 'Not connected' sentinel.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/http/impl/websocket/ClientWebSocketImpl.java:332

  @Override
  public List<Certificate> peerCertificates() throws SSLPeerUnverifiedException {
    return delegate().peerCertificates();
  }

  @Override
  public Future<Void> write(Buffer data) {
    return delegate().write(data);
  }

  @Override
  public boolean writeQueueFull() {
    return delegate().writeQueueFull();
  }

  private WebSocketInternal delegate() {
    WebSocketInternal w = ws;
    if (w == null) {
      throw new IllegalStateException("Not connected");
    }
    return w;
  }
}

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Wait for the connect future to complete before using the WebSocket
  2. Check the socket state or track connection lifecycle before invoking operations
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/http/impl/websocket/ClientWebSocketImpl.java:332 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06). Data as JSON: /api/errors/5085699329463bb3. Report an issue: GitHub.