prometheus/node_exporter · error
could not parse expected integer value for
Error message
could not parse expected integer value for %q
What it means
parsePoolObjsetFile parses an objset kstat file in 'key: type: value' format. When the type is 'uint64' it parses parts[2] with strconv.ParseUint; on failure it returns this error naming the kstat.zfs.misc.objset.<key>. Unlike the pool parser, it does not wrap the underlying parse error, so the cause must be inferred from the named key.
Solutions
- Check the named objset key's value in the procfs/fixture file and make it a valid unsigned integer
- Add %w wrapping of the ParseUint error to ease diagnosis
- Ensure lines follow 'name: uint64: <int>' format exactly
- Refresh fixtures from a live system
Example fix
// before
return fmt.Errorf("could not parse expected integer value for %q", key)
// after
return fmt.Errorf("could not parse expected integer value for %q: %w", key, err) Defensive patterns
Strategy: validation
Validate before calling
parts := strings.Split(strings.TrimSpace(lineStr), " ")
if len(parts) == 3 && parts[1] == "uint64" {
if _, err := strconv.ParseUint(parts[2], 10, 64); err != nil {
// skip line; not a parseable uint64 value
}
} Try / catch
if err := c.parsePoolObjsetFile(f, pool, ds, handler); err != nil {
if strings.Contains(err.Error(), "did not parse a single") || strings.Contains(err.Error(), "could not parse") {
c.logger.Warn("objset parse issue", "err", err)
return nil
}
return err
} Prevention
- Keep 'key: uint64: value' line format strict
- Add %w to the returned error for diagnosability
- Verify dataset names before parsing
- Refresh objset fixtures from live ZFS
When it happens
Trigger: An objset line whose declared type is uint64 has a third field that is empty or non-numeric (e.g. '-'), so strconv.ParseUint fails during updatePoolStats.
Common situations: Fixture files with placeholder values; ZFS versions emitting non-numeric placeholders for some objset stats; line-format drift where the value column moved.
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
- could not parse expected integer value for
- did not parse a single
- ZFS / ZFS statistics are not available
- failed to parse /proc/net/dev
- interrupts empty
AI-assisted analysis of prometheus/node_exporter@17ddd77c59 (2026-09-07).
Data as JSON: /api/errors/aa40a3039839b455.
Report an issue: GitHub.
Appendix: source
Thrown at collector/zfs_linux.go:326
continue
}
if !parseLine || len(parts) < 3 {
continue
}
if parts[0] == "dataset_name" {
zpoolPathElements := strings.Split(zpoolPath, "/")
pathLen := len(zpoolPathElements)
zpoolName = zpoolPathElements[pathLen-2]
datasetName = line[strings.Index(line, parts[2]):]
continue
}
if parts[1] == kstatDataUint64 {
key := fmt.Sprintf("kstat.zfs.misc.objset.%s", parts[0])
value, err := strconv.ParseUint(parts[2], 10, 64)
if err != nil {
return fmt.Errorf("could not parse expected integer value for %q", key)
}
handler(zpoolName, datasetName, zfsSysctl(key), value)
}
}
if !parseLine {
return fmt.Errorf("did not parse a single %s %s metric", zpoolName, datasetName)
}
return scanner.Err()
}
func (c *zfsCollector) parsePoolStateFile(reader io.Reader, zpoolPath string, handler func(string, string, uint64)) error {
scanner := bufio.NewScanner(reader)
scanner.Scan()
actualStateName, err := scanner.Text(), scanner.Err()
if err != nil {
return errView on GitHub (pinned to 17ddd77c59)