slackhq/nebula · error
error windows.Bind(): %w
Error message
error windows.Bind(): %w
What it means
This error wraps windows.Bind failing when binding the RIO socket to the requested address after the RIO request queue was created successfully. Bind errors carry the underlying winsock error (e.g. WSAEADDRINUSE, WSAEACCES) via %w, and bind() returns it to NewRIOListener.
Source
Thrown at udp/udp_rio_windows.go:137
err = u.rx.Open()
if err != nil {
return fmt.Errorf("error rx.Open(): %w", err)
}
err = u.tx.Open()
if err != nil {
return fmt.Errorf("error tx.Open(): %w", err)
}
u.rq, err = winrio.CreateRequestQueue(u.sock, packetsPerRing, 1, packetsPerRing, 1, u.rx.cq, u.tx.cq, 0)
if err != nil {
return fmt.Errorf("error CreateRequestQueue: %w", err)
}
err = windows.Bind(u.sock, sa)
if err != nil {
return fmt.Errorf("error windows.Bind(): %w", err)
}
return nil
}
func (u *RIOConn) ListenOut(r EncReader, flush func()) error {
buffer := make([]byte, MTU)
var lastRecvErr time.Time
for {
// Just read one packet at a time
n, rua, err := u.receive(buffer)
if err != nil {
if errors.Is(err, net.ErrClosed) {
return err
}View on GitHub (pinned to dd8f660c0a)
Solutions
- Check the wrapped error: WSAEADDRINUSE means the port is taken - find/stop the other process or pick a different port.
- Verify the listen address exists on the host (correct interface IP, not a stale address).
- Check Windows excluded port ranges and move the port out of them.
- Ensure ExclusiveAddrUse/privilege requirements are met if WSAEACCES is returned.
Example fix
// before
err = windows.Bind(u.sock, sa)
if err != nil {
return fmt.Errorf("error windows.Bind(): %w", err)
}
// after
err = windows.Bind(u.sock, sa)
if err != nil {
return fmt.Errorf("error windows.Bind(): %w", err) // caller should check errors.Is(err, windows.WSAEADDRINUSE) and retry on a new port
} Defensive patterns
Strategy: retry
Validate before calling
conn, err := net.ListenPacket("udp", addr) // probe availability first
if err != nil {
return fmt.Errorf("udp port %s unavailable: %w", addr, err)
}
conn.Close() Type guard
func isAddrInUse(err error) bool { return errors.Is(err, windows.WSAEADDRINUSE) || errors.Is(err, syscall.WSAEADDRINUSE) } Try / catch
conn, err := udp.NewListener(logger, settings)
if err != nil && isAddrInUse(err) {
// pick a new port or wait for the current holder to release, then retry
} Prevention
- Check netsh excluded port ranges before choosing fixed UDP ports on Windows.
- Use a port-allocation/probing step before startup.
- Ensure only one instance of the service uses the port (singletons/locks).
- Bind to a verified local interface IP, not a stale address.
When it happens
Trigger: NewRIOListener -> bind(): windows.Bind(u.sock, sa) fails because the requested address:port is already in use by another socket, is reserved, or the address does not exist on the host.
Common situations: Another instance of the app (or another service) already holds the UDP port; port falls in Windows' excluded port ranges (netsh int ipv4 show excludedportrange protocol=udp, often carved out by Hyper-V); binding to an IP that is no longer assigned to the machine; insufficient privileges.
Related errors
AI-assisted analysis of slackhq/nebula@dd8f660c0a (2026-09-03).
Data as JSON: /api/errors/3e1dd46d5e8e98b5.
Report an issue: GitHub.