{"record":{"id":"59bb9824b1d05aff","repo":"prometheus/node_exporter","slug":"couldn-t-get-buddyinfo-w","errorCode":null,"errorMessage":"couldn't get buddyinfo: %w","messagePattern":"couldn't get buddyinfo: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/buddyinfo.go","lineNumber":62,"sourceCode":"\t\t[]string{\"node\", \"zone\", \"size\"}, nil,\n\t)\n)\n\n// NewBuddyinfoCollector returns a new Collector exposing buddyinfo stats.\nfunc NewBuddyinfoCollector(logger *slog.Logger) (Collector, error) {\n\tfs, err := procfs.NewFS(*procPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open procfs: %w\", err)\n\t}\n\treturn &buddyinfoCollector{fs, logger}, nil\n}\n\n// Update calls (*buddyinfoCollector).getBuddyInfo to get the platform specific\n// buddyinfo metrics.\nfunc (c *buddyinfoCollector) Update(ch chan<- prometheus.Metric) error {\n\tbuddyInfo, err := c.fs.BuddyInfo()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't get buddyinfo: %w\", err)\n\t}\n\n\tc.logger.Debug(\"Set node_buddy\", \"buddyInfo\", buddyInfo)\n\tfor _, entry := range buddyInfo {\n\t\tfor size, value := range entry.Sizes {\n\t\t\tch <- prometheus.MustNewConstMetric(\n\t\t\t\tbuddyinfoBlocks,\n\t\t\t\tprometheus.GaugeValue, value,\n\t\t\t\tentry.Node, entry.Zone, strconv.Itoa(size),\n\t\t\t)\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":44,"sourceCodeEnd":77,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/buddyinfo.go#L44-L77","documentation":"buddyinfoCollector.Update wraps errors from c.fs.BuddyInfo() in \"couldn't get buddyinfo\". Reading /proc/buddyinfo failed during a scrape even though the procfs handle was created successfully. All node_buddy metrics are skipped for that scrape cycle.","triggerScenarios":"A scrape where /proc/buddyinfo cannot be opened or parsed: the file was removed (unusual kernel builds with CONFIG_PROC_FS restrictions), a container lost procfs visibility after start, or /proc/buddyinfo content does not match the parser's expected format on unusual kernels.","commonSituations":"Hardened kernels or seccomp/LSM setups hiding /proc/buddyinfo; NUMA-less or vendor kernels with nonstandard buddyinfo layout; procfs remounted read-only or hidden in containers mid-run.","solutions":["Check that /proc/buddyinfo exists and is readable (cat /proc/buddyinfo) as the exporter user","Verify no security module or seccomp profile blocks access to /proc/buddyinfo","Upgrade the prometheus/procfs dependency if the kernel emits a changed buddyinfo format","Disable the buddyinfo collector if /proc/buddyinfo is intentionally unavailable in your environment"],"exampleFix":"// before\n if err := updater.Update(ch); err != nil {\n\treturn err\n }\n// after\n if err := updater.Update(ch); err != nil {\n\tlogger.Warn(\"buddyinfo scrape failed; continuing\", \"err\", err)\n\treturn nil // tolerate missing /proc/buddyinfo\n }","handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(\"/proc/buddyinfo\"); err != nil { /* collector will error; skip */ }","typeGuard":null,"tryCatchPattern":"err := collector.Update(ch)\nif err != nil {\n\tif strings.Contains(err.Error(), \"couldn't get buddyinfo\") {\n\t\tlogger.Warn(\"buddyinfo unavailable; skipping\", \"err\", err)\n\t\treturn nil\n\t}\n\treturn err\n}","preventionTips":["Verify /proc/buddyinfo readability after seccomp/LSM changes","Match kernel vendor patches against procfs parser expectations","Upgrade prometheus/procfs when kernel formats change","Treat buddyinfo as optional on hardened kernels"],"tags":["linux","procfs","scrape","buddyinfo"],"backgroundTag":"file-read-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"}