{"record":{"id":"e119dbd09657ab6e","repo":"prometheus/node_exporter","slug":"controller-string-didn-t-match-regexp-s","errorCode":null,"errorMessage":"controller string didn't match regexp: %s","messagePattern":"controller string didn't match regexp: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/edac_linux.go","lineNumber":108,"sourceCode":"\tif err != nil {\n\t\treturn label\n\t}\n\tlabel = strings.TrimSpace(string(labelBytes))\n\tlabel = strings.ReplaceAll(label, \"#\", \"\")\n\tlabel = strings.ReplaceAll(label, \"csrow\", \"_csrow\")\n\tlabel = strings.ReplaceAll(label, \"channel\", \"_channel\")\n\treturn label\n}\n\nfunc (c *edacCollector) Update(ch chan<- prometheus.Metric) error {\n\tmemControllers, err := filepath.Glob(sysFilePath(\"devices/system/edac/mc/mc[0-9]*\"))\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, controller := range memControllers {\n\t\tcontrollerMatch := edacMemControllerRE.FindStringSubmatch(controller)\n\t\tif controllerMatch == nil {\n\t\t\treturn fmt.Errorf(\"controller string didn't match regexp: %s\", controller)\n\t\t}\n\t\tcontrollerNumber := controllerMatch[1]\n\n\t\tvalue, err := readUintFromFile(filepath.Join(controller, \"ce_count\"))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"couldn't get ce_count for controller %s: %w\", controllerNumber, err)\n\t\t}\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tedacCeCount, prometheus.CounterValue, float64(value), controllerNumber)\n\n\t\tvalue, err = readUintFromFile(filepath.Join(controller, \"ce_noinfo_count\"))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"couldn't get ce_noinfo_count for controller %s: %w\", controllerNumber, err)\n\t\t}\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tedacCsRowCECount, prometheus.CounterValue, float64(value), controllerNumber, \"unknown\")\n\n\t\tvalue, err = readUintFromFile(filepath.Join(controller, \"ue_count\"))","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/edac_linux.go#L90-L126","documentation":"The EDAC collector globs /sys/devices/system/edac/memctlr/mc[0-9]* (via the memControllers list) and expects each controller directory string to match edacMemControllerRE. When a controller entry does not match the expected 'mc<N>' naming, Update aborts with this error. It is an internal-format assumption violated by unexpected sysfs content.","triggerScenarios":"A directory under the EDAC memctlr path matching the glob but not the regexp, e.g. mcX, mc-0, or an unusual controller name produced by a nonstandard kernel/EDAC driver.","commonSituations":"Kernels with EDAC drivers that name controllers differently; leftover or synthetic directories in a test fixture or chrooted /sys; kernel version changes altering the EDAC sysfs layout.","solutions":["Inspect the controller path printed in the error and compare with the expected mc<N> pattern","Identify the EDAC driver creating the oddly named directory and check kernel docs for its layout","Update node_exporter or file an issue if a new kernel layout is not matched","Exclude the offending environment (disable the edac collector) if the layout is unsupported"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"matches, _ := filepath.Glob(\"/sys/devices/system/edac/memctlr/mc[0-9]*\")\nre := regexp.MustCompile(`^mc([0-9]+)$`)\nfor _, m := range matches {\n    if !re.MatchString(filepath.Base(m)) {\n        // unexpected EDAC controller naming; edac collector Update will fail\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := c.Update(ch); err != nil {\n    var prefix = \"controller string didn't match regexp\"\n    if strings.HasPrefix(err.Error(), prefix) {\n        // unsupported EDAC layout; disable collector or upgrade node_exporter\n    }\n}","preventionTips":["Pin node_exporter versions known to match your kernel's EDAC layout","Test EDAC collectors on new kernel versions before rollout","Spot-check /sys/devices/system/edac/memctlr contents during kernel upgrades"],"tags":["linux","edac","regex","sysfs"],"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"}