{"record":{"id":"abe57e27fe6afda9","repo":"prometheus/node_exporter","slug":"failed-to-open-procfs-w-abe57e","errorCode":null,"errorMessage":"failed to open procfs: %w","messagePattern":"failed to open procfs: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/processes_linux.go","lineNumber":51,"sourceCode":"\tfs           procfs.FS\n\tthreadAlloc  *prometheus.Desc\n\tthreadLimit  *prometheus.Desc\n\tthreadsState *prometheus.Desc\n\tprocsState   *prometheus.Desc\n\tpidUsed      *prometheus.Desc\n\tpidMax       *prometheus.Desc\n\tlogger       *slog.Logger\n}\n\nfunc init() {\n\tregisterCollector(\"processes\", defaultDisabled, NewProcessStatCollector)\n}\n\n// NewProcessStatCollector returns a new Collector exposing process data read from the proc filesystem.\nfunc NewProcessStatCollector(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\tsubsystem := \"processes\"\n\treturn &processCollector{\n\t\tfs: fs,\n\t\tthreadAlloc: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, subsystem, \"threads\"),\n\t\t\t\"Allocated threads in system\",\n\t\t\tnil, nil,\n\t\t),\n\t\tthreadLimit: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, subsystem, \"max_threads\"),\n\t\t\t\"Limit of threads in the system\",\n\t\t\tnil, nil,\n\t\t),\n\t\tthreadsState: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, subsystem, \"threads_state\"),\n\t\t\t\"Number of threads in each state.\",\n\t\t\t[]string{\"thread_state\"}, nil,","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/processes_linux.go#L33-L69","documentation":"NewProcessStatCollector initializes a procfs filesystem handle via procfs.NewFS(*procPath) and fails the collector constructor when that call errors. This means the proc filesystem could not be opened at the configured path (default /proc), so the process collector cannot be created at all.","triggerScenarios":"procfs.NewFS is called with the --path.procfs flag value and returns an error, e.g. when the procfs mount point does not exist or statfs on it fails during collector construction at exporter startup.","commonSituations":"Running node_exporter on non-Linux setups or in containers where /proc is not mounted; passing --path.procfs pointing to a extracted fixture directory that was deleted; typos in --path.procfs such as --path.procfs=/prco.","solutions":["Check that /proc (or the value of --path.procfs) exists and is a mounted proc filesystem: mount | grep proc.","Fix the --path.procfs flag if it was set incorrectly; the default should be /proc.","In containers, run with /proc mounted (default on Docker/Kubernetes) and avoid masking the whole proc mount.","When running tests, unpack the fixtures (make test unpacks collector/fixtures/sys.ttar) and point --path.procfs at collector/fixtures/sys."],"exampleFix":"// before\nnode_exporter --path.procfs=/prco\n// after\nnode_exporter --path.procfs=/proc","handlingStrategy":"validation","validationCode":"// before launching the exporter / constructing the collector\nfunc procfsAvailable(path string) error {\n    var st syscall.Statfs_t\n    if err := syscall.Statfs(path, &st); err != nil {\n        return err\n    }\n    if st.Type != 0x9fa0 { // PROC_SUPER_MAGIC\n        return fmt.Errorf(\"%s is not a procfs mount\", path)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"collector, err := NewProcessStatCollector(logger)\nif err != nil {\n    log.Fatalf(\"process collector unavailable: %v (is %s a mounted procfs?)\", err, *procPath)\n}","preventionTips":["Never override --path.procfs unless running tests against fixtures.","In containers, confirm /proc is mounted and not fully masked.","Validate the procfs path exists and is procfs in your systemd unit/entrypoint.","For tests, run make test to unpack fixtures before pointing procfs at them."],"tags":["linux","procfs","mount","node-exporter","startup"],"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"}