slackhq/nebula · error

Write failed: %w

Error message

Write failed: %w

What it means

Catch-all wrapping error in NativeTun.Write: AllocateSendPacket failed with an error other than the handled ERROR_HANDLE_EOF (closed) and ERROR_BUFFER_OVERFLOW (ring full, silently dropped). An unexpected Wintun failure allocating a send packet; the error is preserved with %w for upstream inspection.

Source

Thrown at wintun/tun.go:178

		return 0, os.ErrClosed
	}

	packetSize := len(buff) - offset
	tun.rate.update(uint64(packetSize))

	packet, err := tun.session.AllocateSendPacket(packetSize)
	if err == nil {
		copy(packet, buff[offset:])
		tun.session.SendPacket(packet)
		return packetSize, nil
	}
	switch err {
	case windows.ERROR_HANDLE_EOF:
		return 0, os.ErrClosed
	case windows.ERROR_BUFFER_OVERFLOW:
		return 0, nil // Dropping when ring is full.
	}
	return 0, fmt.Errorf("Write failed: %w", err)
}

// LUID returns Windows interface instance ID.
func (tun *NativeTun) LUID() uint64 {
	tun.running.Add(1)
	defer tun.running.Done()
	if atomic.LoadInt32(&tun.close) == 1 {
		return 0
	}
	return tun.wt.LUID()
}

// RunningVersion returns the running version of the Wintun driver.
func (tun *NativeTun) RunningVersion() (version uint32, err error) {
	return wintun.RunningVersion()
}

func (rate *rateJuggler) update(packetLen uint64) {

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Retry the write after a brief pause
  2. Recreate the TUN session if allocation keeps failing
  3. Inspect the wrapped Windows error for driver-level diagnosis
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at wintun/tun.go:178 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slackhq/nebula@dd8f660c0a (2026-09-03). Data as JSON: /api/errors/f3cd1f69e61a629b. Report an issue: GitHub.