{"record":{"id":"a06ddcb3ca1b3e53","repo":"prometheus/node_exporter","slug":"invalid-value-in-numastat-w","errorCode":null,"errorMessage":"invalid value in numastat: %w","messagePattern":"invalid value in numastat: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/meminfo_numa_linux.go","lineNumber":177,"sourceCode":"func parseMemInfoNumaStat(r io.Reader, nodeNumber string) ([]meminfoMetric, error) {\n\tvar (\n\t\tnumaStat []meminfoMetric\n\t\tscanner  = bufio.NewScanner(r)\n\t)\n\n\tfor scanner.Scan() {\n\t\tline := strings.TrimSpace(scanner.Text())\n\t\tif line == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tparts := strings.Fields(line)\n\t\tif len(parts) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"line scan did not return 2 fields: %s\", line)\n\t\t}\n\n\t\tfv, err := strconv.ParseFloat(parts[1], 64)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid value in numastat: %w\", err)\n\t\t}\n\n\t\tnumaStat = append(numaStat, meminfoMetric{parts[0] + \"_total\", prometheus.CounterValue, nodeNumber, fv})\n\t}\n\treturn numaStat, scanner.Err()\n}\n","sourceCodeStart":159,"sourceCodeEnd":184,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/meminfo_numa_linux.go#L159-L184","documentation":"This error is returned by parseMemInfoNumaStat in collector/meminfo_numa_linux.go:177 when strconv.ParseFloat fails on the second field (parts[1]) of a numastat line. The collector expects a numeric counter value; a non-numeric token aborts parsing of the node's numastat file. The underlying strconv error is wrapped via %w.","triggerScenarios":"parseMemInfoNumaStat reads a well-formed 2-field line like 'numa_hit xyz' where the value field is not a valid float — e.g. alphabetic characters, hex values, or a header-like line with text in the value column.","commonSituations":"Nonstandard kernels exposing textual numastat entries; container/virtualization layers emitting placeholder text; corrupted sysfs reads; parsing test fixtures with bad values.","solutions":["Check the failing value column in /sys/devices/system/node/node*/numastat","Skip or coerce non-numeric values if a patched kernel emits headers or text entries","Verify kernel version for numastat format changes and update the parser accordingly","Rebuild with -tags nomeminfo_numa to opt out of this collector","Report unexpected numastat content upstream if produced by a stock kernel"],"exampleFix":"// before\nfv, err := strconv.ParseFloat(parts[1], 64)\nif err != nil {\n\treturn nil, fmt.Errorf(\"invalid value in numastat: %w\", err)\n}\n// after (skip non-numeric values)\nfv, err := strconv.ParseFloat(parts[1], 64)\nif err != nil {\n\tcontinue\n}","handlingStrategy":"validation","validationCode":"// Validate the value field is numeric before parse\nparts := strings.Fields(line)\nif len(parts) == 2 {\n\tif _, err := strconv.ParseFloat(parts[1], 64); err != nil {\n\t\treturn fmt.Errorf(\"non-numeric numastat value %q in %q\", parts[1], line)\n\t}\n}","typeGuard":null,"tryCatchPattern":"_, err := parseMemInfoNumaStat(f, node)\nif err != nil {\n\tvar numErr *strconv.NumError\n\tif errors.As(err, &numErr) {\n\t\t// skip node's numastat metrics and continue collection\n\t}\n\treturn err\n}","preventionTips":["Inspect numastat content on unusual platforms (VMs, containers) before enabling meminfo_numa","Strip header/text lines when pre-processing sysfs files in test setups","Keep kernel and node_exporter versions aligned to tested combinations","Monitor scrape error metrics to catch non-numeric sysfs drift"],"tags":["linux","sysfs","parsing","numastat","numa"],"backgroundTag":"invalid-argument-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"}