{"record":{"id":"1293bbcdbdd6cc5c","repo":"prometheus/node_exporter","slug":"failed-to-open-procfs-w","errorCode":null,"errorMessage":"failed to open procfs: %w","messagePattern":"failed to open procfs: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/arp_linux.go","lineNumber":57,"sourceCode":"}\n\nfunc init() {\n\tregisterCollector(\"arp\", defaultEnabled, NewARPCollector)\n}\n\nvar (\n\tarpEntries = prometheus.NewDesc(\n\t\tprometheus.BuildFQName(namespace, \"arp\", \"entries\"),\n\t\t\"ARP entries by device\",\n\t\t[]string{\"device\"}, nil,\n\t)\n)\n\n// NewARPCollector returns a new Collector exposing ARP stats.\nfunc NewARPCollector(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 &arpCollector{\n\t\tfs:           fs,\n\t\tdeviceFilter: newDeviceFilter(*arpDeviceExclude, *arpDeviceInclude),\n\t\tlogger:       logger,\n\t}, nil\n}\n\nfunc getTotalArpEntries(deviceEntries []procfs.ARPEntry) map[string]uint32 {\n\tentries := make(map[string]uint32)\n\n\tfor _, device := range deviceEntries {\n\t\tentries[device.Device]++\n\t}\n\n\treturn entries\n}","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/arp_linux.go#L39-L75","documentation":"NewARPCollector initializes a procfs filesystem handle rooted at --path.procfs; if procfs.NewFS fails (the mount point is missing or unreadable) construction fails with 'failed to open procfs: %w' wrapping the underlying error.","triggerScenarios":"Creating an ARPCollector when /proc (or the path passed via --path.procfs) is not a valid procfs mount — e.g., wrong path flag or procfs not mounted.","commonSituations":"Containers where /proc is not mounted or a custom --path.procfs points elsewhere in test setups; typos in the procfs path flag.","solutions":["Ensure /proc is mounted in the container/namespace running node_exporter.","Verify the --path.procfs flag points at a mounted proc filesystem.","Check mount permissions for the exporter user."],"exampleFix":"// before\nnode_exporter --path.procfs=/host/proc  # directory lacks procfs\n// after\nmount -t proc proc /host/proc && node_exporter --path.procfs=/host/proc","handlingStrategy":"validation","validationCode":"if fi, err := os.Stat(*procPath); err != nil || !fi.IsDir() {\n    return fmt.Errorf(\"procfs path %q is not a mounted directory\", *procPath)\n}","typeGuard":null,"tryCatchPattern":"c, err := NewARPCollector(logger)\nif err != nil {\n    logger.Error(\"collector init failed\", \"err\", err)\n    os.Exit(1)\n}","preventionTips":["Mount /proc into containers before starting the exporter.","Verify --path.procfs when using host-namespace proc mounts.","Start exporters with a minimal smoke test to catch init errors early."],"tags":["go","linux","procfs","arp"],"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"}