prometheus/node_exporter · error

could not parse expected unsigned integer value for

Error message

could not parse expected unsigned integer value for %q: %w

What it means

parseProcfsFile hit a kstat line in /proc/spl/kstat/zfs/... whose data column was declared uint64 but strconv.ParseUint rejected the value. The ZFS kstat file contains data that is not a valid base-10 unsigned integer — malformed or newer-format kstat output.

Solutions

  1. Inspect the offending kstat file under /proc/spl/kstat/zfs/ to find the non-numeric value.
  2. Upgrade node_exporter/procfs handling if a newer ZFS emits a new data type or format.
  3. Report the ZFS version; consider skipping that kstat file via collector configuration if unparseable.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at collector/zfs_linux.go:238 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prometheus/node_exporter@17ddd77c59 (2026-09-07). Data as JSON: /api/errors/bf81763cdd02083d. Report an issue: GitHub.

Appendix: source

Thrown at collector/zfs_linux.go:238

		if !parseLine && len(parts) == 3 && parts[0] == "name" && parts[1] == "type" && parts[2] == "data" {
			// Start parsing from here.
			parseLine = true
			continue
		}

		if !parseLine || len(parts) < 3 {
			continue
		}

		// kstat data type (column 2) should be KSTAT_DATA_UINT64, otherwise ignore
		// TODO: when other KSTAT_DATA_* types arrive, much of this will need to be restructured
		key := fmt.Sprintf("kstat.zfs.misc.%s.%s", fmtExt, parts[0])
		switch parts[1] {
		case kstatDataUint64:
			value, err := strconv.ParseUint(parts[2], 10, 64)
			if err != nil {
				return fmt.Errorf("could not parse expected unsigned integer value for %q: %w", key, err)
			}
			handler(zfsSysctl(key), value)
		case kstatDataInt64:
			value, err := strconv.ParseInt(parts[2], 10, 64)
			if err != nil {
				return fmt.Errorf("could not parse expected signed integer value for %q: %w", key, err)
			}
			handler(zfsSysctl(key), value)
		}
	}
	if !parseLine {
		return fmt.Errorf("did not parse a single %q metric", fmtExt)
	}

	return scanner.Err()
}

func (c *zfsCollector) parsePoolProcfsFile(reader io.Reader, zpoolPath string, handler func(string, zfsSysctl, uint64)) error {

View on GitHub (pinned to 17ddd77c59)