prometheus/node_exporter · error
invalid value in numastat
Error message
invalid value in numastat: %w
What it means
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.
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
Example fix
// before
fv, err := strconv.ParseFloat(parts[1], 64)
if err != nil {
return nil, fmt.Errorf("invalid value in numastat: %w", err)
}
// after (skip non-numeric values)
fv, err := strconv.ParseFloat(parts[1], 64)
if err != nil {
continue
} Defensive patterns
Strategy: validation
Validate before calling
// Validate the value field is numeric before parse
parts := strings.Fields(line)
if len(parts) == 2 {
if _, err := strconv.ParseFloat(parts[1], 64); err != nil {
return fmt.Errorf("non-numeric numastat value %q in %q", parts[1], line)
}
} Try / catch
_, err := parseMemInfoNumaStat(f, node)
if err != nil {
var numErr *strconv.NumError
if errors.As(err, &numErr) {
// skip node's numastat metrics and continue collection
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Nonstandard kernels exposing textual numastat entries; container/virtualization layers emitting placeholder text; corrupted sysfs reads; parsing test fixtures with bad values.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- line scan did not return 2 fields
- invalid value in meminfo
- invalid line in meminfo
- couldn't get NUMA meminfo
- device node string didn't match regexp
AI-assisted analysis of prometheus/node_exporter@17ddd77c59 (2026-09-07).
Data as JSON: /api/errors/a06ddcb3ca1b3e53.
Report an issue: GitHub.
Appendix: source
Thrown at collector/meminfo_numa_linux.go:177
func parseMemInfoNumaStat(r io.Reader, nodeNumber string) ([]meminfoMetric, error) {
var (
numaStat []meminfoMetric
scanner = bufio.NewScanner(r)
)
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
if line == "" {
continue
}
parts := strings.Fields(line)
if len(parts) != 2 {
return nil, fmt.Errorf("line scan did not return 2 fields: %s", line)
}
fv, err := strconv.ParseFloat(parts[1], 64)
if err != nil {
return nil, fmt.Errorf("invalid value in numastat: %w", err)
}
numaStat = append(numaStat, meminfoMetric{parts[0] + "_total", prometheus.CounterValue, nodeNumber, fv})
}
return numaStat, scanner.Err()
}
View on GitHub (pinned to 17ddd77c59)