{"record":{"id":"863c9c9806030204","repo":"netbirdio/netbird","slug":"stop-w","errorCode":null,"errorMessage":"stop: %w","messagePattern":"stop: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"client/embed/embed.go","lineNumber":331,"sourceCode":"\tif c.cancel != nil {\n\t\tc.cancel()\n\t\tc.cancel = nil\n\t}\n\n\tdone := make(chan error, 1)\n\tconnect := c.connect\n\tgo func() {\n\t\tdone <- connect.Stop()\n\t}()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\tc.connect = nil\n\t\treturn ctx.Err()\n\tcase err := <-done:\n\t\tc.connect = nil\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"stop: %w\", err)\n\t\t}\n\t\treturn nil\n\t}\n}\n\n// GetConfig returns a copy of the internal client config.\nfunc (c *Client) GetConfig() (profilemanager.Config, error) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tif c.config == nil {\n\t\treturn profilemanager.Config{}, ErrConfigNotInitialized\n\t}\n\treturn *c.config, nil\n}\n\n// Dial dials a network address in the netbird network.\n// Not applicable if the userspace networking mode is disabled.\nfunc (c *Client) Dial(ctx context.Context, network, address string) (net.Conn, error) {","sourceCodeStart":313,"sourceCodeEnd":349,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/embed/embed.go#L313-L349","documentation":"Returned by Client.Stop when ConnectClient.Stop completes but reports an error tearing down the engine (interface removal, firewall/DNS cleanup, management disconnect). The stop path already ran to completion, so this error means cleanup was imperfect, not that the client is still running: c.connect is cleared either way.","triggerScenarios":"Client.Stop after a partially started or degraded engine: firewall/DNS cleanup fails because system state changed underneath, interface already removed externally, or management disconnect errors surface during teardown.","commonSituations":"Stopping after a failed Start; host networking state mutated by other tooling (iptables flushed, interface deleted manually); stopping while the management connection is already broken.","solutions":["Inspect the wrapped error to identify the subsystem that failed cleanup.","Verify host state manually if the error mentions the interface or firewall (ip link, nft list ruleset) and clean up leftovers.","Treat the client as stopped regardless: Stop is called once and c.connect is nil afterwards; create a new Client to restart.","Enable debug logs before stopping to capture the engine-side teardown reason."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"stopCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\nif err := client.Stop(stopCtx); err != nil {\n    // client is stopped regardless; log and verify host state manually if needed\n    log.Warnf(\"stop reported cleanup error: %v\", err)\n}","preventionTips":["Give Stop its own generous deadline context.","Treat Stop errors as cleanup warnings; check interface/firewall state if the wrapped error names them."],"tags":["shutdown","lifecycle","cleanup","embed"],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}