netbirdio/netbird · error

recreate

Error message

recreate: %w

What it means

link.recreate failed during Create of the kernel-mode device: the netlink link (re)creation — deleting any existing link and adding a new WireGuard link — did not succeed. Without the kernel link nothing else (addresses, MTU, configuration) can be applied, so Create aborts here.

Solutions

  1. Remove the stale link manually (ip link del) and retry
  2. Check netlink permissions (root)
  3. Retry Create; recreation is idempotent
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at client/iface/device/device_kernel_unix.go:55 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at client/iface/device/device_kernel_unix.go:55

func NewKernelDevice(name string, address wgaddr.Address, wgPort int, key string, mtu uint16, transportNet transport.Net) *TunKernelDevice {
	ctx, cancel := context.WithCancel(context.Background())
	return &TunKernelDevice{
		ctx:          ctx,
		ctxCancel:    cancel,
		name:         name,
		address:      address,
		wgPort:       wgPort,
		key:          key,
		mtu:          mtu,
		transportNet: transportNet,
	}
}

func (t *TunKernelDevice) Create() (WGConfigurer, error) {
	link := newWGLink(t.name)

	if err := link.recreate(); err != nil {
		return nil, fmt.Errorf("recreate: %w", err)
	}

	t.link = link

	if err := t.assignAddr(); err != nil {
		return nil, fmt.Errorf("assign addr: %w", err)
	}

	// TODO: do a MTU discovery
	log.Debugf("setting MTU: %d interface: %s", t.mtu, t.name)

	if err := link.setMTU(int(t.mtu)); err != nil {
		return nil, fmt.Errorf("set mtu: %w", err)
	}

	configurer := configurer.NewKernelConfigurer(t.name)

	if err := configurer.ConfigureInterface(t.key, t.wgPort); err != nil {

View on GitHub (pinned to 93e97f4bf1)