{"record":{"id":"b5e425a3fbf69202","repo":"prometheus/node_exporter","slug":"failed-to-open-procfs-w-b5e425","errorCode":null,"errorMessage":"failed to open procfs: %w","messagePattern":"failed to open procfs: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/udp_queues_linux.go","lineNumber":44,"sourceCode":")\n\ntype (\n\tudpQueuesCollector struct {\n\t\tfs     procfs.FS\n\t\tdesc   *prometheus.Desc\n\t\tlogger *slog.Logger\n\t}\n)\n\nfunc init() {\n\tregisterCollector(\"udp_queues\", defaultEnabled, NewUDPqueuesCollector)\n}\n\n// NewUDPqueuesCollector returns a new Collector exposing network udp queued bytes.\nfunc NewUDPqueuesCollector(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\treturn &udpQueuesCollector{\n\t\tfs: fs,\n\t\tdesc: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, \"udp\", \"queues\"),\n\t\t\t\"Number of allocated memory in the kernel for UDP datagrams in bytes.\",\n\t\t\t[]string{\"queue\", \"ip\"}, nil,\n\t\t),\n\t\tlogger: logger,\n\t}, nil\n}\n\nfunc (c *udpQueuesCollector) Update(ch chan<- prometheus.Metric) error {\n\n\ts4, errIPv4 := c.fs.NetUDPSummary()\n\tif errIPv4 == nil {\n\t\tch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(s4.TxQueueLength), \"tx\", \"v4\")\n\t\tch <- prometheus.MustNewConstMetric(c.desc, prometheus.GaugeValue, float64(s4.RxQueueLength), \"rx\", \"v4\")","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/udp_queues_linux.go#L26-L62","documentation":"NewUDPqueuesCollector wraps procfs.NewFS(*procPath) failures as 'failed to open procfs: %w'. procfs.NewFS validates that the path (from --path.procfs, default /proc) exists and is a directory, so a constructor failure means no UDP queue metrics can ever be collected from this instance.","triggerScenarios":"Calling NewUDPqueuesCollector when --path.procfs points to a nonexistent path or a regular file instead of a mounted procfs directory.","commonSituations":"Containers without /proc mounted or with an altered --path.procfs, typo'd systemd flag values, and host-path remounts in Kubernetes that hide /proc.","solutions":["Ensure /proc exists and is a mounted procfs directory.","Fix the --path.procfs flag to the correct path.","In containers, mount /proc from the host (or run with the proper volume mounts).","Verify the exporter user can stat/traverse the procfs directory."],"exampleFix":"// before\nnode_exporter --path.procfs=/nonexistent/proc\n// after\nnode_exporter --path.procfs=/proc","handlingStrategy":"validation","validationCode":"if fi, err := os.Stat(procfsPath); err != nil || !fi.IsDir() {\n    // procfs unavailable: don't enable udp_queues collector\n}","typeGuard":null,"tryCatchPattern":"c, err := collector.NewUDPqueuesCollector(logger)\nif err != nil {\n    logger.Warn(\"udp_queues collector disabled\", \"err\", err)\n} else {\n    registry.MustRegister(c)\n}","preventionTips":["Verify --path.procfs points to a mounted procfs directory.","Mount /proc in containers (usually default, but check in minimal images).","Conditionally register collectors on constructor success.","Avoid typos in path flags by templating deployment configs."],"tags":["linux","procfs","udp","collector-init"],"backgroundTag":"file-not-found","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"}