{"record":{"id":"ba3a9f631040f6a1","repo":"prometheus/node_exporter","slug":"failed-to-open-procfs-w-ba3a9f","errorCode":null,"errorMessage":"failed to open procfs: %w","messagePattern":"failed to open procfs: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/schedstat_linux.go","lineNumber":57,"sourceCode":"\t\tprometheus.BuildFQName(namespace, \"schedstat\", \"waiting_seconds_total\"),\n\t\t\"Number of seconds spent by processing waiting for this CPU.\",\n\t\t[]string{\"cpu\"},\n\t\tnil,\n\t)\n\n\ttimeslicesTotal = prometheus.NewDesc(\n\t\tprometheus.BuildFQName(namespace, \"schedstat\", \"timeslices_total\"),\n\t\t\"Number of timeslices executed by CPU.\",\n\t\t[]string{\"cpu\"},\n\t\tnil,\n\t)\n)\n\n// NewSchedstatCollector returns a new Collector exposing task scheduler statistics\nfunc NewSchedstatCollector(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 &schedstatCollector{fs, logger}, nil\n}\n\ntype schedstatCollector struct {\n\tfs     procfs.FS\n\tlogger *slog.Logger\n}\n\nfunc init() {\n\tregisterCollector(\"schedstat\", defaultEnabled, NewSchedstatCollector)\n}\n\nfunc (c *schedstatCollector) Update(ch chan<- prometheus.Metric) error {\n\tstats, err := c.fs.Schedstat()\n\tif err != nil {\n\t\tif errors.Is(err, os.ErrNotExist) {","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/schedstat_linux.go#L39-L75","documentation":"NewSchedstatCollector wraps the error from procfs.NewFS(*procPath) with 'failed to open procfs'. The configured proc filesystem path (--path.procfs, default /proc) could not be opened as a valid procfs mount, so the collector cannot be constructed.","triggerScenarios":"Starting node_exporter with --path.procfs pointing to a nonexistent or non-procfs directory; NewSchedstatCollector fails at construction time and the scheduler-statistics collector never registers.","commonSituations":"Running in a container with /proc mounted at a different host path; typo in --path.procfs; minimal/chroot images without /proc mounted.","solutions":["Fix --path.procfs to point at a mounted proc filesystem (usually /proc)","Mount /proc into the container or bind-mount it at the configured path","Verify the path contains typical proc files (stat, uptime) before starting"],"exampleFix":"// before\nnode_exporter --path.procfs=/host/proc-not-mounted\n// after\nnode_exporter --path.procfs=/host/proc  # where /host/proc is a bind-mounted /proc","handlingStrategy":"validation","validationCode":"func ensureProcfs(path string) error {\n\tif _, err := os.Stat(filepath.Join(path, \"stat\")); err != nil {\n\t\treturn fmt.Errorf(\"%q is not a mounted procfs: %w\", path, err)\n\t}\n\treturn nil\n}\n// call before starting: ensureProcfs(*procPath)","typeGuard":null,"tryCatchPattern":"c, err := NewSchedstatCollector(logger)\nif err != nil {\n\tlogger.Error(\"schedstat collector not registered\", \"err\", err)\n}","preventionTips":["Keep --path.procfs at the default /proc unless running against a bind-mounted host /proc","In containers, mount /proc (or the host's /proc read-only) at the configured path","Verify the path with `ls <path>/stat` before deployment"],"tags":["procfs","startup","linux","schedstat"],"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"}