{"record":{"id":"3b2c4d3734b6fc18","repo":"prometheus/node_exporter","slug":"failed-to-access-wifi-data-w","errorCode":null,"errorMessage":"failed to access wifi data: %w","messagePattern":"failed to access wifi data: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/wifi_linux.go","lineNumber":166,"sourceCode":"\treturn &wifiCollector{\n\t\tlogger: logger,\n\t}, nil\n}\n\nfunc (c *wifiCollector) Update(ch chan<- prometheus.Metric) error {\n\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,","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/wifi_linux.go#L148-L184","documentation":"The wifi collector's Update creates a wifi stat handle via the local wifi library (netlink-based). Errors from establishing that handle — other than os.ErrPermission, which is downgraded to ErrNoData — are wrapped as 'failed to access wifi data: %w'. It means the collector could not begin querying wireless interface information at all.","triggerScenarios":"wifiCollector.Update when the wifi stat handle creation fails with non-EPERM errors — typically nl80211/cfg80211 not available in the kernel, or netlink socket creation failing.","commonSituations":"Running on servers/wired-only hosts without wireless extensions, kernels built without cfg80211/nl80211, containers without access to the host's network netlink namespace, and unprivileged users hitting permission-related paths (those return ErrNoData instead).","solutions":["Confirm the host actually has wireless interfaces and cfg80211/nl80211 support (lsmod | grep cfg80211).","Disable the wifi collector on hosts with no wireless hardware.","Run in the host network namespace so netlink queries reach the real kernel.","Check the wrapped error; EPERM is intentionally downgraded to ErrNoData."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// probe nl80211 availability before enabling wifi collection\n// e.g. run: iw list  (or check /sys/class/net/*/wireless exists)\nhasWireless := false\nents, _ := os.ReadDir(\"/sys/class/net\")\nfor _, e := range ents {\n    if _, err := os.Stat(\"/sys/class/net/\" + e.Name() + \"/wireless\"); err == nil {\n        hasWireless = true\n    }\n}\n_ = hasWireless","typeGuard":null,"tryCatchPattern":"if err := c.Update(ch); err != nil {\n    if errors.Is(err, ErrNoData) { return }\n    if strings.Contains(err.Error(), \"failed to access wifi data\") {\n        logger.Warn(\"wifi metrics unavailable\", \"err\", err)\n        return\n    }\n    return err\n}","preventionTips":["Only enable the wifi collector on hosts with actual wireless interfaces.","Run with the host network namespace so netlink/nl80211 queries succeed.","Verify cfg80211/nl80211 kernel support before deployment.","Treat EPERM-derived ErrNoData as an expected skip, not a failure."],"tags":["linux","wifi","netlink","network"],"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"}