slackhq/nebula · error

failed to set address: %w

Error message

failed to set address: %w

What it means

Activate() failed while assigning the VPN IP addresses to the TUN interface via winipcfg LUID.SetIPAddresses. The library wraps the winipcfg error so callers know address configuration on the adapter failed. This typically reflects an OS-level rejection of the IP assignment.

Source

Thrown at overlay/tun_windows.go:159

		}

		// Ensure any routes we actually want are installed
		err = t.addRoutes(true)
		if err != nil {
			// Catch any stray logs
			util.LogWithContextIfNeeded("Failed to add routes", err, t.l)
		}
	}

	return nil
}

func (t *winTun) Activate() error {
	luid := winipcfg.LUID(t.tun.LUID())

	err := luid.SetIPAddresses(t.vpnNetworks)
	if err != nil {
		return fmt.Errorf("failed to set address: %w", err)
	}

	err = t.addRoutes(false)
	if err != nil {
		return err
	}

	if t.setCategory {
		// The wintun adapter takes a moment to register with the Network List
		// Manager, so we apply the category in the background and retry until
		// it shows up.
		go applyNetworkCategory(t.l, t.guid, t.networkCategory)
	}

	if t.bypassWDF {
		t.wdfBypass = installInterfaceBypass(t.l, uint64(t.tun.LUID()))
	}

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Verify the static_host_map/tun address and subnet mask in config are a valid CIDR
  2. Check for another adapter using the same IP/subnet (ipconfig /all) and remove it
  3. Remove and recreate stale VPN adapters
  4. Restart the nebula process after fixing config
  5. Check the wrapped error's winipcode (e.g. ERROR_OBJECT_ALREADY_EXISTS) for the specific cause

Example fix

// before
tun:
  routes: []
  override_kernel: true
static_single: 10.0.0.2/99
// after
tun:
  routes: []
static_single: 10.0.0.2/24
Defensive patterns

Strategy: validation

Validate before calling

// validate configured CIDR before activation
for _, n := range cfg.Networks {
    if _, _, err := net.ParseCIDR(string(n)); err != nil {
        return fmt.Errorf("invalid tun network %q: %w", n, err)
    }
}

Try / catch

if err := tun.Activate(); err != nil {
    if strings.Contains(err.Error(), "failed to set address") {
        // check duplicate IP / subnet conflict and retry once
    }
    return err
}

Prevention

When it happens

Trigger: luid.SetIPAddresses(t.vpnNetworks) returns an error during interface activation — e.g. the configured address is invalid, already assigned, or conflicts with another adapter.

Common situations: Duplicate static IP on another interface; malformed tunes/overlay address in config (wrong CIDR); another VPN adapter holding the same subnet; race with adapter teardown.

Related errors


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