{"record":{"id":"1cf26d748ef8d940","repo":"prometheus/node_exporter","slug":"failed-to-open-procfs-w-1cf26d","errorCode":null,"errorMessage":"failed to open procfs: %w","messagePattern":"failed to open procfs: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/conntrack_linux.go","lineNumber":159,"sourceCode":"\tch <- prometheus.MustNewConstMetric(\n\t\tconntrackSearchRestart, prometheus.GaugeValue, float64(conntrackStats.searchRestart))\n\treturn nil\n}\n\nfunc (c *conntrackCollector) handleErr(err error) error {\n\tif errors.Is(err, os.ErrNotExist) {\n\t\tc.logger.Debug(\"conntrack probably not loaded\")\n\t\treturn ErrNoData\n\t}\n\treturn fmt.Errorf(\"failed to retrieve conntrack stats: %w\", err)\n}\n\nfunc getConntrackStatistics() (*conntrackStatistics, error) {\n\ts := conntrackStatistics{}\n\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\tconnStats, err := fs.ConntrackStat()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, connStat := range connStats {\n\t\ts.found += connStat.Found\n\t\ts.invalid += connStat.Invalid\n\t\ts.ignore += connStat.Ignore\n\t\ts.insert += connStat.Insert\n\t\ts.insertFailed += connStat.InsertFailed\n\t\ts.drop += connStat.Drop\n\t\ts.earlyDrop += connStat.EarlyDrop\n\t\ts.searchRestart += connStat.SearchRestart\n\t}\n","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/conntrack_linux.go#L141-L177","documentation":"getConntrackStatistics cannot initialize the procfs filesystem handle at --path.procfs and returns this wrapped error before attempting any reads. procfs.NewFS validates that the given path is a usable proc filesystem, so this indicates the configured proc path itself is wrong or inaccessible.","triggerScenarios":"procfs.NewFS(*procPath) returns an error: --path.procfs points to a nonexistent directory, a non-procfs filesystem, or an unreadable path.","commonSituations":"Wrong --path.procfs value on containers/chroots; testing on macOS/Windows where /proc does not exist; mount namespace differences in Kubernetes where /proc of the host is mounted at /host/proc but the flag was not updated.","solutions":["Pass the correct --path.procfs (e.g. /host/proc when host proc is bind-mounted there)","Verify the directory exists and is a procfs mount (mount | grep proc)","On non-Linux hosts, disable the conntrack collector instead"],"exampleFix":"// before\nnode_exporter --path.procfs=/wrong/proc\n// after\nnode_exporter --path.procfs=/host/proc","handlingStrategy":"validation","validationCode":"// Go: verify the proc path is usable before constructing the collector\nif fi, err := os.Stat(*procPath); err != nil || !fi.IsDir() {\n    return fmt.Errorf(\"--path.procfs %q is not a directory\", *procPath)\n}","typeGuard":null,"tryCatchPattern":"c, err := NewNodeCollector(filters...)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to open procfs\") {\n        log.Error(\"bad --path.procfs; check mount/flag\", \"err\", err)\n    }\n    return err\n}","preventionTips":["Always pair container bind-mounts (-v /proc:/host/proc:ro) with --path.procfs=/host/proc","Smoke-test node_exporter startup flags in staging","Only use Linux builds on Linux hosts"],"tags":["procfs","configuration","linux"],"backgroundTag":"file-open-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"}