{"record":{"id":"e29f309d9822c661","repo":"netbirdio/netbird","slug":"last-ip-w","errorCode":null,"errorMessage":"last ip: %w","messagePattern":"last ip: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/iface/device/device_netstack.go","lineNumber":64,"sourceCode":"func NewNetstackDevice(name string, address wgaddr.Address, wgPort int, key string, mtu uint16, bind Bind, listenAddress string) *TunNetstackDevice {\n\treturn &TunNetstackDevice{\n\t\tname:          name,\n\t\taddress:       address,\n\t\tport:          wgPort,\n\t\tkey:           key,\n\t\tmtu:           mtu,\n\t\tlistenAddress: listenAddress,\n\t\tbind:          bind,\n\t}\n}\n\nfunc (t *TunNetstackDevice) create() (WGConfigurer, error) {\n\tlog.Info(\"create nbnetstack tun interface\")\n\n\t// TODO: get from service listener runtime IP\n\tdnsAddr, err := nbnet.GetLastIPFromNetwork(t.address.Network, 1)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"last ip: %w\", err)\n\t}\n\n\taddresses := []netip.Addr{t.address.IP}\n\tif t.address.HasIPv6() {\n\t\taddresses = append(addresses, t.address.IPv6)\n\t}\n\tlog.Debugf(\"netstack using addresses: %v\", addresses)\n\tt.nsTun = nbnetstack.NewNetStackTun(t.listenAddress, addresses, dnsAddr, int(t.mtu))\n\tlog.Debugf(\"netstack using dns address: %s\", dnsAddr)\n\ttunIface, net, err := t.nsTun.Create()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating tun device: %s\", err)\n\t}\n\tt.filteredDevice = newDeviceFilter(tunIface)\n\tt.net = net\n\n\tt.device = device.NewDevice(\n\t\tt.filteredDevice,","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/iface/device/device_netstack.go#L46-L82","documentation":"GetLastIPFromNetwork failed while create() derived the DNS listener address (last address of the overlay network) from the assigned netstack address. Without this address the embedded DNS server has nothing to bind to, so netstack device creation aborts before building the TUN.","triggerScenarios":"Thrown at client/iface/device/device_netstack.go:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the overlay network prefix is valid and large enough","Check the address family of the configured network","Fix the network configuration and recreate the device"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","contentChangedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}