{"record":{"id":"879ea5415adfbc2f","repo":"prometheus/node_exporter","slug":"couldn-t-get-s-w","errorCode":null,"errorMessage":"couldn't get %s: %w","messagePattern":"couldn't get (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/slabinfo_linux.go","lineNumber":61,"sourceCode":"\nfunc NewSlabinfoCollector(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\n\treturn &slabinfoCollector{logger: logger,\n\t\tfs:             fs,\n\t\tsubsystem:      \"slabinfo\",\n\t\tlabels:         []string{\"slab\"},\n\t\tslabNameFilter: newDeviceFilter(*slabNameExclude, *slabNameInclude),\n\t}, nil\n}\n\nfunc (c *slabinfoCollector) Update(ch chan<- prometheus.Metric) error {\n\tslabinfo, err := c.fs.SlabInfo()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't get %s: %w\", c.subsystem, err)\n\t}\n\n\tfor _, slab := range slabinfo.Slabs {\n\t\tif c.slabNameFilter.ignored(slab.Name) {\n\t\t\tcontinue\n\t\t}\n\t\tch <- c.activeObjects(slab.Name, slab.ObjActive)\n\t\tch <- c.objects(slab.Name, slab.ObjNum)\n\t\tch <- c.objectSizeBytes(slab.Name, slab.ObjSize)\n\t\tch <- c.objectsPerSlab(slab.Name, slab.ObjPerSlab)\n\t\tch <- c.pagesPerSlab(slab.Name, slab.PagesPerSlab)\n\t}\n\n\treturn nil\n}\n\nfunc (c *slabinfoCollector) activeObjects(label string, val int64) prometheus.Metric {\n\tdesc := prometheus.NewDesc(","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/slabinfo_linux.go#L43-L79","documentation":"slabinfoCollector.Update wraps errors from fs.SlabInfo() with \"couldn't get slabinfo: %w\". The collector was constructed successfully, but reading or parsing /proc/slabinfo via procfs failed during a scrape.","triggerScenarios":"fs.SlabInfo() returning an error at scrape time: /proc/slabinfo became unreadable, or the kernel's slabinfo content could not be parsed by the vendored procfs version.","commonSituations":"Hardened kernels restricting /proc/slabinfo to privileged users; kernels newer than the procfs dependency with a changed slabinfo format.","solutions":["Run node_exporter with privileges sufficient to read /proc/slabinfo (often root)","Update github.com/prometheus/procfs to a version that parses your kernel's slabinfo","Leave the slabinfo collector disabled (it is defaultDisabled) if the data is not needed"],"exampleFix":"// before (go.mod)\ngithub.com/prometheus/procfs v0.9.0\n// after\ngo get github.com/prometheus/procfs@latest && go mod tidy","handlingStrategy":"try-catch","validationCode":"// pre-check readability before enabling\nif f, err := os.Open(\"/proc/slabinfo\"); err != nil {\n\t// slabinfo unreadable; keep collector disabled\n} else {\n\tf.Close()\n}","typeGuard":null,"tryCatchPattern":"if err := collector.Update(ch); err != nil {\n\tvar msg string\n\tif _, perr := fmt.Sscanf(err.Error(), \"couldn't get slabinfo:\"); perr == nil {\n\t\tlogger.Warn(\"slabinfo scrape failed\", \"err\", err)\n\t} else {\n\t\treturn err\n\t}\n}","preventionTips":["Run the exporter with enough privileges for /proc/slabinfo (kernel often restricts it to root)","Keep github.com/prometheus/procfs updated to match your kernel series","Keep the collector disabled (default) on hosts where slabinfo is not needed"],"tags":["procfs","scrape","linux","slabinfo"],"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"}