{"record":{"id":"443e9857a9188767","repo":"netbirdio/netbird","slug":"error-assigning-ip-s-443e98","errorCode":null,"errorMessage":"error assigning ip: %s","messagePattern":"error assigning ip: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/iface/device/device_windows.go","lineNumber":109,"sourceCode":"\t}\n\n\tif t.address.HasIPv6() {\n\t\tnbiface6, err := luid.IPInterface(windows.AF_INET6)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"failed to get IPv6 interface for MTU, continuing v4-only: %v\", err)\n\t\t\tt.address.ClearIPv6()\n\t\t} else {\n\t\t\tnbiface6.NLMTU = uint32(t.mtu)\n\t\t\tif err := nbiface6.Set(); err != nil {\n\t\t\t\tlog.Warnf(\"failed to set IPv6 interface MTU, continuing v4-only: %v\", err)\n\t\t\t\tt.address.ClearIPv6()\n\t\t\t}\n\t\t}\n\t}\n\terr = t.assignAddr()\n\tif err != nil {\n\t\tt.device.Close()\n\t\treturn nil, fmt.Errorf(\"error assigning ip: %s\", err)\n\t}\n\n\tt.configurer = configurer.NewUSPConfigurer(t.device, t.name, t.iceBind.ActivityRecorder())\n\terr = t.configurer.ConfigureInterface(t.key, t.port)\n\tif err != nil {\n\t\tt.device.Close()\n\t\tt.configurer.Close()\n\t\treturn nil, fmt.Errorf(\"error configuring interface: %s\", err)\n\t}\n\treturn t.configurer, nil\n}\n\nfunc (t *TunDevice) Up() (*udpmux.UniversalUDPMuxDefault, error) {\n\terr := t.device.Up()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/iface/device/device_windows.go#L91-L127","documentation":"Windows Create() failed at assignAddr, which programs the adapter's IP address, mask and associated routes through winipcfg after the MTU steps. Any failure inside that address/route configuration closes the device and surfaces under this wrap. The inner error identifies the failing winipcfg operation.","triggerScenarios":"The overlay address already assigned to another adapter, an invalid address/prefix from management, winipcfg API failure, or the adapter being removed mid-configuration.","commonSituations":"Overlay network range overlapping the LAN, stale configuration from a previous run, third-party firewall blocking interface configuration.","solutions":["Read the wrapped error to identify the failing winipcfg call","Check that the assigned NetBird IP range does not overlap the local LAN","Remove the stale adapter so the agent recreates it cleanly","Ensure the service is running elevated"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check the overlay range does not collide with an existing adapter\naddrs, _ := winipcfg.GetUnicastIPAddresses(windows.AF_INET, nil)\nfor _, a := range addrs {\n    if a.Address.IP().Is4() && overlayRange.Contains(a.Address.IP()) {\n        log.Warnf(\"address %s already present on another interface\", a.Address.IP())\n    }\n}","typeGuard":null,"tryCatchPattern":"if _, err := dev.Create(); err != nil {\n    if strings.Contains(err.Error(), \"error assigning ip\") {\n        // read the wrapped winipcfg error; check overlaps and stale adapters\n    }\n    return err\n}","preventionTips":["Choose overlay ranges that cannot overlap the LAN","Remove stale adapters before reconnecting","Run the service elevated so winipcfg calls succeed"],"tags":["windows","ip-address","routes","winipcfg"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}