{"record":{"id":"62924a9529142b71","repo":"netbirdio/netbird","slug":"this-function-has-not-been-implemented-in-netstack","errorCode":null,"errorMessage":"this function has not been implemented in Netstack for Android","messagePattern":"this function has not been implemented in Netstack for Android","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/iface/device/device_netstack_android.go","lineNumber":13,"sourceCode":"//go:build android\n\npackage device\n\nimport \"fmt\"\n\nfunc (t *TunNetstackDevice) Create(routes []string, dns string, searchDomains []string) (WGConfigurer, error) {\n\treturn t.create()\n}\n\nfunc (t *TunNetstackDevice) RenewTun(fd int) error {\n\t// Doesn't make sense in Android for Netstack.\n\treturn fmt.Errorf(\"this function has not been implemented in Netstack for Android\")\n}\n","sourceCodeStart":1,"sourceCodeEnd":15,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/iface/device/device_netstack_android.go#L1-L15","documentation":"TunNetstackDevice.RenewTun is an intentional stub in the android build of netstack mode. In netstack mode traffic is stitched inside gVisor sockets and never traverses an Android VPNService tun fd, so there is nothing to renew and the method always returns this error, as the in-code comment states.","triggerScenarios":"Calling RenewTun(fd) on a TunNetstackDevice compiled with the android build tag (client/iface/device/device_netstack_android.go).","commonSituations":"Engine code shared across modes that handles VpnService fd re-establishment reaching the netstack branch for the first time; an Android integration upgrade where this path becomes live.","solutions":["Gate RenewTun calls so they only run in kernel/userspace modes that own a real tun fd","Treat this error as a benign no-op sentinel in shared code instead of failing the flow","Switch to userspace mode when fd renewal is genuinely required"],"exampleFix":"// before\nif err := dev.RenewTun(fd); err != nil {\n    return err\n}\n\n// after\nif err := dev.RenewTun(fd); err != nil {\n    if runtime.GOOS != \"android\" {\n        return err\n    }\n    log.Debug(\"RenewTun is a stub on android netstack; ignoring\")\n}","handlingStrategy":"type-guard","validationCode":"// netstack on android has no tun fd to renew\nif runtime.GOOS == \"android\" && usingNetstack {\n    return nil // RenewTun is a documented stub there\n}\nreturn dev.RenewTun(fd)","typeGuard":"type tunFdRenewer interface {\n    RenewTun(fd int) error\n}\n\n// only kernel/userspace devices implement a meaningful RenewTun;\n// feature-detect or branch on mode before calling it","tryCatchPattern":"if err := dev.RenewTun(fd); err != nil {\n    if runtime.GOOS == \"android\" {\n        log.Debug(\"RenewTun not implemented on android netstack; skipping\")\n    } else {\n        return err\n    }\n}","preventionTips":["Branch on networking mode (kernel/userspace/netstack) before fd-level operations","Document stubs as sentinel errors and compare explicitly instead of generic handling","Cover android builds in CI for shared engine paths"],"tags":["android","netstack","not-implemented","go"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}