netbirdio/netbird · warning

ipc get: %w

Error message

ipc get: %w

What it means

WGUSPConfigurer.fetchStats, the periodic refresher behind GetStats' stats cache, failed to read the device state with device.IpcGet(). It occurs when the wireguard-go device is closed or its state is unavailable at the moment the cache TTL expires. GetStats propagates it, so monitoring sees repeated failures until the device is running again.

Source

Thrown at client/iface/configurer/usp.go:361

		}
	}

	if runtime.GOOS == "linux" {
		sockPath := "/var/run/wireguard/" + t.deviceName + ".sock"
		if _, statErr := os.Stat(sockPath); statErr == nil {
			_ = os.Remove(sockPath)
		}
	}
}

func (t *WGUSPConfigurer) GetStats() (map[string]WGStats, error) {
	return t.statsCache.get()
}

func (t *WGUSPConfigurer) fetchStats() (map[string]WGStats, error) {
	ipc, err := t.device.IpcGet()
	if err != nil {
		return nil, fmt.Errorf("ipc get: %w", err)
	}

	return parseTransfers(ipc)
}

func parseTransfers(ipc string) (map[string]WGStats, error) {
	stats := make(map[string]WGStats)
	var (
		currentKey   string
		currentStats WGStats
		hasPeer      bool
	)
	lines := strings.Split(ipc, "\n")
	for _, line := range lines {
		line = strings.TrimSpace(line)

		// If we're within the details of the found peer and encounter another public key,
		// this means we're starting another peer's details. So, stop.

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Drop the configurer (and its cache) when the device is replaced so stale fetchers stop running
  2. Return the cached snapshot or an empty map on fetch failure instead of erroring every poll
  3. Retry the fetch after the new device signals readiness
  4. Stop stats pollers before closing the device in shutdown order
Defensive patterns

Strategy: fallback

Try / catch

stats, err := uspCfg.GetStats()
if err != nil {
	// device churn between IpcGet and cache refresh: serve last snapshot
	log.Debugf("stats fetch failed, serving cached: %v", err)
	stats = lastGoodStats
}
return stats, nil

Prevention

When it happens

Trigger: Cache refresh firing after device Close but before the configurer is discarded; reconnect window where the old device is gone and the new one is not yet up; internal UAPI serialization error during a heavy load spike.

Common situations: Frequent reconnects on unreliable links causing device churn; agent shutdown with a stats poller still attached; netstack/embedded deployments with short-lived devices.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/9e9e6697f297bd02. Report an issue: GitHub.