This document describes every error code in the WasabiError enumeration,
including what triggers each error, what the associated system codes mean,
and how to diagnose and resolve common failures.
Wasabi exposes three levels of error information per connection.
Dim errType As WasabiError
Dim sysCode As Long
Dim details As String
errType = WebSocketGetLastError(handle)
sysCode = WebSocketGetLastErrorCode(handle)
details = WebSocketGetTechnicalDetails(handle)
Debug.Print "Error:", errType
Debug.Print "System code:", sysCode
Debug.Print "Details:", details
errType is the high-level Wasabi error category. It tells you what failed.
sysCode is the raw error code from the underlying system call. For Winsock errors, this is a WSA error code. For TLS errors, this is an SSPI/HRESULT status code. For successful operations, this is zero.
details is a human-readable string describing the specific failure, including the function name and the numeric code. This is the most useful field for debugging.
[!TIP] Always log all three values when diagnosing connection issues. The
WebSocketGetErrorDescriptionfunction combines them into a single diagnostic string.
A typical error handling pattern looks like this.
Sub ConnectSafely()
Dim h As Long
If Not WebSocketConnect("wss://echo.websocket.org", h) Then
Select Case WebSocketGetLastError(h)
Case ERR_DNS_RESOLVE_FAILED
Debug.Print "Cannot resolve hostname"
Case ERR_CONNECT_FAILED
Debug.Print "Server unreachable"
Case ERR_TLS_HANDSHAKE_FAILED
Debug.Print "TLS negotiation failed"
Case ERR_HANDSHAKE_REJECTED
Debug.Print "Server rejected WebSocket upgrade"
Case ERR_PROXY_AUTH_FAILED
Debug.Print "Proxy credentials rejected"
Case ERR_MAX_CONNECTIONS
Debug.Print "Connection pool full"
Case Else
Debug.Print "Unexpected error:", WebSocketGetLastError(h)
End Select
Debug.Print "System code:", WebSocketGetLastErrorCode(h)
Debug.Print "Details:", WebSocketGetTechnicalDetails(h)
Exit Sub
End If
Debug.Print "Connected successfully"
End Sub
No error occurred. The operation completed successfully.
What happened: WSAStartup returned a non-zero value. The Winsock
subsystem could not be initialized.
Common causes:
What to check:
netsh winsock reset from an elevated command prompt and reboot' Example error output
' Error: 1
' System code: 10091
' Details: WSAStartup failed with code 10091
What happened: The socket() function returned INVALID_SOCKET. A TCP
socket could not be allocated.
Common causes:
What to check:
WebSocketGetConnectionCount to see if the pool is near capacity' Example error output
' Error: 2
' System code: 10024
' Details: socket() failed with WSA error 10024
[!NOTE] WSA error 10024 means
WSAEMFILE(too many open sockets).
What happened: gethostbyname() could not resolve the hostname to an IP
address.
Common causes:
System codes and their meaning:
| WSA Code | Name | Meaning |
|---|---|---|
| 11001 | WSAHOST_NOT_FOUND | The hostname does not exist in DNS |
| 11002 | WSATRY_AGAIN | Temporary DNS failure, try again later |
| 11003 | WSANO_RECOVERY | Non-recoverable DNS error |
| 11004 | WSANO_DATA | Hostname exists but has no IP address record |
What to check:
' Example error output
' Error: 3
' System code: 11001
' Details: gethostbyname() failed for 'bad.hostname.example' with WSAHOST_NOT_FOUND (11001)
[!TIP] If you see error 11002, wait a moment and try again. This is typically a transient DNS issue that resolves itself.
What happened: The TCP connection could not be established. Either
connect() failed immediately or select() timed out waiting for the
connection to complete. This includes failures from the Happy Eyeballs
dual‑stack connection process.
Common causes:
What to check:
WebSocketSetProxyws://, 443 for wss://)' Example error output
' Error: 4
' System code: 10060
' Details: Connect failed: WSAETIMEDOUT - Connection timed out
[!NOTE] WSA error 10060 means
WSAETIMEDOUT. WSA error 10061 meansWSAECONNREFUSED(server actively refused the connection).
What happened: AcquireCredentialsHandle could not initialize the
Schannel security provider.
Common causes:
What to check:
' Example error output
' Error: 5
' System code: -2146893043
' Details: AcquireCredentialsHandle failed: 0x8009030D
What happened: InitializeSecurityContext returned a fatal error during
the TLS handshake.
Common causes:
What to check:
openssl s_client' Example error output
' Error: 6
' System code: -2146893018
' Details: TLS handshake failed: 0x80090326
[!WARNING] SSPI error
0x80090326meansSEC_E_ILLEGAL_MESSAGE. This often indicates a middlebox (corporate proxy or firewall) is intercepting and corrupting TLS traffic.
What happened: The TLS handshake did not complete within the allowed time or iteration limit.
Common causes:
What to check:
WebSocketSetReceiveTimeout' Example error output
' Error: 7
' System code: 0
' Details: TLS handshake timed out with api.example.com
What happened: Wasabi could not send or receive the HTTP upgrade request that initiates the WebSocket connection.
Common causes:
What to check:
' Example error output
' Error: 8
' System code: 10054
' Details: recv() WS handshake failed: WSAECONNRESET - Connection reset by peer
[!NOTE] WSA error 10054 means
WSAECONNRESET(connection reset by peer).
What happened: The server did not respond to the HTTP upgrade request within the timeout period.
Common causes:
What to check:
' Example error output
' Error: 9
' System code: 0
' Details: No WS handshake response within 5s
What happened: A send() call returned zero or negative after attempting
to write data to the socket.
Common causes:
What to check:
WebSocketIsConnected before sending' Example error output
' Error: 10
' System code: 10054
' Details: send() failed: WSAECONNRESET - Connection reset by peer
What happened: A recv() call returned a negative value.
Common causes:
ERR_SEND_FAILEDWhat to check:
What happened: A send operation was attempted on a handle that is not currently connected.
Common causes:
What to check:
WebSocketConnect before sendingWebSocketIsConnected before each send in long-running loops' Safe send pattern
If WebSocketIsConnected(h) Then
WebSocketSend "data", h
Else
Debug.Print "Not connected"
End If
Reserved for future use.
What happened: EncryptMessage returned a non-zero SSPI status code.
The outgoing data could not be encrypted.
Common causes:
What to check:
WebSocketGetLastErrorCodeWhat happened: DecryptMessage returned a fatal error other than
SEC_I_RENEGOTIATE (which is handled separately by ERR_TLS_RENEGOTIATE).
Common causes:
What to check:
What happened: The URL could not be parsed.
Common causes:
ws:// or wss://What to check:
ws://host/path or wss://host:port/path' Valid URLs
WebSocketConnect "ws://localhost/chat"
WebSocketConnect "wss://api.example.com/ws"
WebSocketConnect "wss://api.example.com:8443/stream"
' Invalid URLs
WebSocketConnect "http://example.com" ' wrong scheme
WebSocketConnect "wss://" ' missing host
WebSocketConnect "wss://host:abc/path" ' non-numeric port
WebSocketConnect "wss://host:99999/path" ' port out of range
What happened: The server responded to the HTTP upgrade request with a
status code other than 101, or the Sec-WebSocket-Accept header value did
not match the expected SHA-1 hash.
Common causes:
What to check:
WebSocketAddHeader if required' Example error output
' Error: 17
' System code: 0
' Details: WebSocket upgrade rejected. Server response: HTTP/1.1 403 Forbidden
[!TIP] The technical details string includes the server’s HTTP status line, which is often enough to diagnose the issue without external tools.
What happened: The connection was lost during normal operation. This
can be triggered by recv() returning zero (clean server close),
ioctlsocket failing, or an oversized frame being received.
Common causes:
What to check:
WebSocketSetPingInterval to keep the connection aliveWebSocketSetBufferSizes' Resilient connection pattern
WebSocketSetAutoReconnect True, 10, 2000, h
WebSocketSetPingInterval 25000, h
What happened: The handle passed to a function is outside the valid range (0 to 63).
Common causes:
What to check:
WebSocketConnect returned True before using the handleWebSocketDisconnectWhat happened: All 64 slots in the connection pool are occupied.
Common causes:
What to check:
WebSocketDisconnect on handles you no longer needWebSocketGetConnectionCount to monitor pool usageWebSocketGetAllHandles to find and audit active connections' Audit active connections
Dim handles() As Long
Dim i As Long
handles = WebSocketGetAllHandles()
Debug.Print "Active connections:", WebSocketGetConnectionCount()
For i = LBound(handles) To UBound(handles)
Debug.Print "Handle", handles(i), _
"Host:", WebSocketGetHost(handles(i)), _
"Uptime:", WebSocketGetUptime(handles(i)), "s"
Next i
What happened: The HTTP CONNECT request to the proxy server failed.
Either the send() to the proxy failed, the proxy did not respond, or the
proxy response could not be read.
Common causes:
What to check:
WebSocketGetProxyInfoWhat happened: The proxy returned HTTP 407 (Proxy Authentication Required) or the SOCKS5 authentication handshake failed.
Common causes:
What to check:
WebSocketSetProxyWebSocketSetProxyNtlm True[!NOTE] Wasabi supports HTTP Basic and NTLM/Kerberos (via
WebSocketSetProxyNtlm) for HTTP proxies. For SOCKS5, only username/password authentication is available.
What happened: The proxy accepted the connection but returned a non-200 status for the CONNECT tunnel request.
Common causes:
What to check:
' Example error output
' Error: 23
' System code: 0
' Details: Proxy CONNECT rejected: HTTP/1.1 403 Forbidden
What happened: No data was received from the server within the configured inactivity timeout period.
Common causes:
What to check:
WebSocketSetInactivityTimeoutWebSocketSetPingInterval' Recommended resilient configuration
WebSocketSetInactivityTimeout 60000, h
WebSocketSetPingInterval 25000, h
WebSocketSetAutoReconnect True, 5, 2000, h
[!TIP] Combining
WebSocketSetInactivityTimeoutwithWebSocketSetPingIntervalandWebSocketSetAutoReconnectcreates the most resilient connection configuration available in Wasabi.
What happened: Wasabi failed to load a client certificate from a PFX file
or the Windows certificate store. The certificate was configured via
WebSocketSetClientCert or WebSocketSetClientCertPfx but could not be
found, imported, or parsed.
Common causes:
What to check:
WebSocketSetClientCert, use a valid certificate subject or thumbprint' Example error output
' Error: 25
' System code: 0
' Details: PFX file not found: C:\certs\client.pfx
[!NOTE] If client certificate loading fails, Wasabi will continue the connection without a client certificate and log a warning. The server may then reject the TLS handshake if mTLS is required.
What happened: Server certificate validation was enabled
(WebSocketSetCertValidation True) and the chain verification failed.
Common causes:
WebSocketSetRevocationCheck is enabled, the certificate may have been
revoked or the CRL/OCSP responder is unreachableWhat to check:
WebSocketSetRevocationCheck True),
consider disabling it temporarily to isolate the issueWhat happened: A fragmented WebSocket message grew larger than the
configured FragmentBuffer size.
The received continuation frames accumulated a payload that exceeded the buffer capacity. The connection is closed to prevent memory corruption.
Common causes:
What to check:
WebSocketSetBufferSizes before connecting' Increasing the fragment buffer to 1 MB
WebSocketSetBufferSizes 262144, 1048576, h
What happened: The server requested a TLS renegotiation after the initial handshake was complete. Wasabi does not support renegotiation and closes the connection.
Common causes:
What to check:
[!NOTE] Wasabi intentionally does not implement TLS renegotiation due to the complexity of handling it correctly in single-threaded VBA. Auto reconnect is the recommended recovery mechanism.
When a connection fails, run through this list in order.
| Step | Check | How |
|---|---|---|
| 1 | Is the URL valid? | Verify scheme, host, port, and path |
| 2 | Can you reach the host? | Ping the hostname from a command prompt |
| 3 | Is DNS resolving? | Try using an IP address instead of hostname |
| 4 | Is a proxy required? | Check with your network administrator |
| 5 | Is TLS the issue? | Try ws:// instead of wss:// to isolate |
| 6 | Is the path correct? | Verify the WebSocket endpoint with a browser tool |
| 7 | Are headers required? | Check if the server needs Authorization or other headers |
| 8 | What did the server say? | Read WebSocketGetTechnicalDetails for the server response |
| 9 | Is the pool full? | Check WebSocketGetConnectionCount |
| 10 | Is auto reconnect working? | Check WebSocketGetReconnectInfo |
These are the most frequently encountered Winsock error codes in Wasabi diagnostic output.
| Code | Name | Meaning |
|---|---|---|
| 10035 | WSAEWOULDBLOCK | Operation would block (normal for non-blocking sockets) |
| 10038 | WSAENOTSOCK | Socket handle is not valid |
| 10053 | WSAECONNABORTED | Connection aborted by local software |
| 10054 | WSAECONNRESET | Connection reset by remote host |
| 10060 | WSAETIMEDOUT | Connection timed out |
| 10061 | WSAECONNREFUSED | Connection actively refused by target |
| 11001 | WSAHOST_NOT_FOUND | Hostname does not exist |
| 11002 | WSATRY_AGAIN | Temporary DNS failure |
| 11003 | WSANO_RECOVERY | Non-recoverable DNS error |
| 11004 | WSANO_DATA | Hostname valid but no IP address available |
These are the most frequently encountered Schannel/SSPI error codes.
| Code (hex) | Name | Meaning |
|---|---|---|
| 0x80090300 | SEC_E_INSUFFICIENT_MEMORY | Not enough memory for security operation |
| 0x80090304 | SEC_E_INTERNAL_ERROR | Internal Schannel error |
| 0x80090305 | SEC_E_NOT_OWNER | Caller does not own the credentials |
| 0x8009030D | SEC_E_UNKNOWN_CREDENTIALS | Credentials not recognized |
| 0x80090311 | SEC_E_NO_AUTHENTICATING_AUTHORITY | No authority could be contacted for authentication |
| 0x80090318 | SEC_E_INCOMPLETE_MESSAGE | Received TLS record is incomplete (internal, handled by Wasabi) |
| 0x80090326 | SEC_E_ILLEGAL_MESSAGE | Received message is corrupted or unexpected |
| 0x00090312 | SEC_I_CONTINUE_NEEDED | Handshake needs more data (internal, handled by Wasabi) |
| 0x00090321 | SEC_I_RENEGOTIATE | Server requested TLS renegotiation (now handled as ERR_TLS_RENEGOTIATE) |