https://github.com/nhooyr/websocket/blob/master/handshake.go#L332 On line 332: rwc will always be nil if the cast fails, so %T will print `<nil>` instead of a proper type. Current: `return nil, resp, fmt.Errorf("response body is not a io.ReadWriteCloser: %T", rwc)` Corrected: `return nil, resp, fmt.Errorf("response body is not a io.ReadWriteCloser: %T", resp.Body)`