{"record":{"id":"4e7cdf174a595ec8","repo":"prometheus/node_exporter","slug":"device-node-string-didn-t-match-regexp-s","errorCode":null,"errorMessage":"device node string didn't match regexp: %s","messagePattern":"device node string didn't match regexp: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/meminfo_numa_linux.go","lineNumber":111,"sourceCode":"\t\t\treturn nil, err\n\t\t}\n\t\tdefer meminfoFile.Close()\n\n\t\tnumaInfo, err := parseMemInfoNuma(meminfoFile)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmetrics = append(metrics, numaInfo...)\n\n\t\tnumastatFile, err := os.Open(filepath.Join(node, \"numastat\"))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer numastatFile.Close()\n\n\t\tnodeNumber := meminfoNodeRE.FindStringSubmatch(node)\n\t\tif nodeNumber == nil {\n\t\t\treturn nil, fmt.Errorf(\"device node string didn't match regexp: %s\", node)\n\t\t}\n\n\t\tnumaStat, err := parseMemInfoNumaStat(numastatFile, nodeNumber[1])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmetrics = append(metrics, numaStat...)\n\t}\n\n\treturn metrics, nil\n}\n\nfunc parseMemInfoNuma(r io.Reader) ([]meminfoMetric, error) {\n\tvar (\n\t\tmemInfo []meminfoMetric\n\t\tscanner = bufio.NewScanner(r)\n\t\tre      = regexp.MustCompile(`\\((.*)\\)`)\n\t)","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/meminfo_numa_linux.go#L93-L129","documentation":"getMemInfoNuma extracts the NUMA node number from each globbed path with the regexp .*devices/system/node/node([0-9]*). If a path returned by the glob does not match (no capture group), the collector aborts with this error rather than emit metrics with an unknown node label. This indicates the sysfs topology contains node entries outside the expected nodeN naming scheme.","triggerScenarios":"filepath.Glob(sysFilePath(\"devices/system/node/node[0-9]*\")) returns a path whose tail after 'node' is empty or non-numeric — e.g. a directory named exactly 'node' with no digits, or symlinks/odd entries under /sys/devices/system/node that satisfy the glob but not the capture group.","commonSituations":"Exotic or virtualized environments presenting nonstandard sysfs NUMA entries; overlaid or synthetic sysfs in containers/sandboxes; custom --path.sysfs pointing at a fixture or mirror directory that contains files not matching nodeN; kernel/firmware quirks exposing node0 with unusual topology naming.","solutions":["Inspect /sys/devices/system/node (or --path.sysfs/devices/system/node) and identify the entry that fails to match node[0-9]+; remove or correct the offending path if it is a fixture/mirror","Verify --path.sysfs points at a genuine sysfs mount, not a partial copy with stray entries","If the kernel exposes valid nodes with nonstandard names, update the procfs/sysfs source or the regexp in a patched build to match the actual naming scheme","As a workaround, disable the meminfo_numa collector (--collector.meminfo_numa is disabled by default) since plain meminfo collection is unaffected"],"exampleFix":"// before\nvar meminfoNodeRE = regexp.MustCompile(`.*devices/system/node/node([0-9]*)`)\n// after (require at least one digit so 'node' with no number is rejected by the glob instead)\nvar meminfoNodeRE = regexp.MustCompile(`.*devices/system/node/node([0-9]+)$`)","handlingStrategy":"validation","validationCode":"re := regexp.MustCompile(`.*devices/system/node/node([0-9]+)$`)\nnodes, _ := filepath.Glob(\"/sys/devices/system/node/node[0-9]*\")\nfor _, node := range nodes {\n    if !re.MatchString(node) {\n        log.Printf(\"unexpected sysfs entry, meminfo_numa would fail: %s\", node)\n    }\n}","typeGuard":null,"tryCatchPattern":"// node_exporter treats any Update error as a failed scrape for this collector;\n// guard by pre-validating sysfs before enabling the collector flag:\nif bad := nonstandardNodePaths(\"/sys/devices/system/node\"); len(bad) > 0 {\n    log.Printf(\"not enabling meminfo_numa, unexpected entries: %v\", bad)\n} else {\n    flags = append(flags, \"--collector.meminfo_numa\")\n}","preventionTips":["Point --path.sysfs only at genuine sysfs mounts, not fixture/mirror directories","Audit /sys/devices/system/node for nonstandard entries in virtualized environments","Keep node_exporter updated if your kernel exposes nonstandard NUMA naming"],"tags":["linux","numa","sysfs","regexp"],"backgroundTag":"invalid-identifier-format","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"}