{"record":{"id":"aa40a3039839b455","repo":"prometheus/node_exporter","slug":"could-not-parse-expected-integer-value-for-q","errorCode":null,"errorMessage":"could not parse expected integer value for %q","messagePattern":"could not parse expected integer value for %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/zfs_linux.go","lineNumber":326,"sourceCode":"\t\t\tcontinue\n\t\t}\n\n\t\tif !parseLine || len(parts) < 3 {\n\t\t\tcontinue\n\t\t}\n\t\tif parts[0] == \"dataset_name\" {\n\t\t\tzpoolPathElements := strings.Split(zpoolPath, \"/\")\n\t\t\tpathLen := len(zpoolPathElements)\n\t\t\tzpoolName = zpoolPathElements[pathLen-2]\n\t\t\tdatasetName = line[strings.Index(line, parts[2]):]\n\t\t\tcontinue\n\t\t}\n\n\t\tif parts[1] == kstatDataUint64 {\n\t\t\tkey := fmt.Sprintf(\"kstat.zfs.misc.objset.%s\", parts[0])\n\t\t\tvalue, err := strconv.ParseUint(parts[2], 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"could not parse expected integer value for %q\", key)\n\t\t\t}\n\t\t\thandler(zpoolName, datasetName, zfsSysctl(key), value)\n\t\t}\n\t}\n\tif !parseLine {\n\t\treturn fmt.Errorf(\"did not parse a single %s %s metric\", zpoolName, datasetName)\n\t}\n\n\treturn scanner.Err()\n}\n\nfunc (c *zfsCollector) parsePoolStateFile(reader io.Reader, zpoolPath string, handler func(string, string, uint64)) error {\n\tscanner := bufio.NewScanner(reader)\n\tscanner.Scan()\n\n\tactualStateName, err := scanner.Text(), scanner.Err()\n\tif err != nil {\n\t\treturn err","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/zfs_linux.go#L308-L344","documentation":"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.","triggerScenarios":"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.","commonSituations":"Fixture files with placeholder values; ZFS versions emitting non-numeric placeholders for some objset stats; line-format drift where the value column moved.","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"],"exampleFix":"// before\nreturn fmt.Errorf(\"could not parse expected integer value for %q\", key)\n// after\nreturn fmt.Errorf(\"could not parse expected integer value for %q: %w\", key, err)","handlingStrategy":"validation","validationCode":"parts := strings.Split(strings.TrimSpace(lineStr), \" \")\nif len(parts) == 3 && parts[1] == \"uint64\" {\n    if _, err := strconv.ParseUint(parts[2], 10, 64); err != nil {\n        // skip line; not a parseable uint64 value\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := c.parsePoolObjsetFile(f, pool, ds, handler); err != nil {\n    if strings.Contains(err.Error(), \"did not parse a single\") || strings.Contains(err.Error(), \"could not parse\") {\n        c.logger.Warn(\"objset parse issue\", \"err\", err)\n        return nil\n    }\n    return err\n}","preventionTips":["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"],"tags":["zfs","parsing","procfs","objset"],"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"}