{"record":{"id":"fac66c349066db23","repo":"prometheus/node_exporter","slug":"failed-to-retrieve-wifi-interfaces-w","errorCode":null,"errorMessage":"failed to retrieve wifi interfaces: %w","messagePattern":"failed to retrieve wifi interfaces: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/wifi_linux.go","lineNumber":172,"sourceCode":"\tstat, err := newWifiStater(*collectorWifi)\n\tif err != nil {\n\t\t// Cannot access wifi metrics, report no error.\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\tc.logger.Debug(\"wifi collector metrics are not available for this system\")\n\t\t\treturn ErrNoData\n\t\t}\n\t\tif errors.Is(err, os.ErrPermission) {\n\t\t\tc.logger.Debug(\"wifi collector got permission denied when accessing metrics\")\n\t\t\treturn ErrNoData\n\t\t}\n\n\t\treturn fmt.Errorf(\"failed to access wifi data: %w\", err)\n\t}\n\tdefer stat.Close()\n\n\tifis, err := stat.Interfaces()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to retrieve wifi interfaces: %w\", err)\n\t}\n\n\tfor _, ifi := range ifis {\n\t\t// Some virtual devices have no \"name\" and should be skipped.\n\t\tif ifi.Name == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tc.logger.Debug(\"probing wifi device with type\", \"wifi\", ifi.Name, \"type\", ifi.Type)\n\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\twifiInterfaceFrequencyHertz,\n\t\t\tprometheus.GaugeValue,\n\t\t\tmHzToHz(ifi.Frequency),\n\t\t\tifi.Name,\n\t\t)\n\n\t\t// When a statistic is not available for a given interface, package wifi","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/wifi_linux.go#L154-L190","documentation":"node_exporter's wifi collector wraps any error returned by the wifi package's stat.Interfaces() call, which queries the kernel via netlink (NL80211_CMD_GET_INTERFACE) to enumerate wireless interfaces. If the netlink dump fails, the collector aborts the whole scrape and returns this wrapped error, so no wifi metrics are produced for the scrape.","triggerScenarios":"stat.Interfaces() returns an error during wifiCollector.Update — e.g. the netlink socket creation or interface dump fails, the process lacks permission to issue NL80211 commands, or the kernel rejects the netlink request.","commonSituations":"Running node_exporter inside a container without CAP_NET_ADMIN, restricted netlink permissions (SELinux/AppArmor), unusual kernels/network namespaces where the nl80211 family is unavailable, or a wifi driver misbehaving on the netlink query.","solutions":["Check whether the host actually has wifi interfaces; if not, disable the wifi collector with --collector.wifi so the error stops occurring.","Run node_exporter with sufficient privileges (CAP_NET_ADMIN / not inside a netns that blocks netlink) and re-test.","Verify netlink nl80211 is available: 'ip link' shows wifi devices and the kernel supports CONFIG_CFG80211.","Inspect the underlying wrapped error (%w) in logs to identify whether it is permission, socket, or protocol related.","Update to a recent node_exporter / mdlayher/wifi release in case of a kernel-compat bug."],"exampleFix":"// before\nnode_exporter --collector.wifi   # fails in container without wifi/netlink\n// after\nnode_exporter --collector.wifi   # or simply omit the flag; wifi is opt-in\n# or grant: docker run --cap-add NET_ADMIN ...","handlingStrategy":"try-catch","validationCode":"// Go: before enabling, check the host can enumerate wifi interfaces\nif _, err := os.ReadDir(\"/sys/class/net\"); err != nil {\n    // no network sysfs access; skip enabling the wifi collector\n}\n// or probe: iw dev must list wireless devices for metrics to exist","typeGuard":"// Go: inspect the wrapped netlink error before treating it as fatal\nvar nlErr xerrors.WrappedError\nif errors.As(err, &nlErr) && errors.Is(err, os.ErrPermission) {\n    // degrade gracefully instead of failing the scrape\n}","tryCatchPattern":"if err := coll.Update(ch); err != nil {\n    if strings.Contains(err.Error(), \"failed to retrieve wifi interfaces\") {\n        logger.Warn(\"wifi netlink enumeration failed; skipping wifi metrics\", \"err\", err)\n        return nil // degrade, don't fail the scrape\n    }\n    return err\n}","preventionTips":["Only enable --collector.wifi on hosts that actually have wireless interfaces","Run node_exporter with CAP_NET_ADMIN when wifi metrics are needed","Verify nl80211 support (CONFIG_CFG80211) on the target kernel before deploying","Monitor the wrapped cause (%w) to distinguish permission vs protocol failures"],"tags":["linux","netlink","wifi","collector"],"backgroundTag":"network-request-failed","analyzedSha":"17ddd77c59ba27e1508e9f7894b1e55b44d6aed3","analyzedAt":"2026-09-07T17:54:06.211Z","contentChangedAt":"2026-09-07T17:54:06.211Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}