{"record":{"id":"87ef0dbaf7b78147","repo":"prometheus/node_exporter","slug":"did-not-parse-a-single-s-s-metric","errorCode":null,"errorMessage":"did not parse a single %s %s metric","messagePattern":"did not parse a single (.+?) (.+?) metric","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/zfs_linux.go","lineNumber":332,"sourceCode":"\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\n\t}\n\n\tactualStateName = strings.ToLower(actualStateName)\n\n\tzpoolPathElements := strings.Split(zpoolPath, \"/\")\n\tpathLen := len(zpoolPathElements)","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/zfs_linux.go#L314-L350","documentation":"parsePoolObjsetFile requires that at least one uint64 metric line was successfully parsed for the given pool/dataset; if parseLine is still false after scanning the whole file it reports that no metric matched 'did not parse a single <pool> <dataset> metric'. This guards against silently exporting zero metrics from an empty or wrong-format file.","triggerScenarios":"The objset file contains no lines in 'key: uint64: value' form, only type declarations without data lines, or the file is empty — i.e. the dataset name in the path/file does not match any parsed content.","commonSituations":"Pointing the collector at a nonexistent dataset; ZFS upgrade changing objset kstat layout; fixtures containing only a header/type section; typo'd zpool or dataset name.","solutions":["Verify the zpool and dataset names in the file path actually exist in the file content","Check the file is a full objset kstat dump including data lines, not just types","Dump a fresh objset file from a live system (cat /proc/spl/kstat/zfs/<pool>/objset-*) and compare format","Update collector or ZFS if the kstat format changed"],"exampleFix":"// before\nerr := c.parsePoolObjsetFile(f, \"badpool\", \"ds\", handler)\n// after\nif _, err := os.Stat(\"/proc/spl/kstat/zfs/badpool/ds\"); err != nil {\n    return // dataset does not exist; skip before parsing\n}","handlingStrategy":"validation","validationCode":"data, _ := os.ReadFile(\"/proc/spl/kstat/zfs/tank/objset-0x2a\")\nif len(bytes.TrimSpace(data)) == 0 {\n    // file empty: skip before calling parsePoolObjsetFile\n}","typeGuard":null,"tryCatchPattern":"if err := c.parsePoolObjsetFile(f, pool, ds, handler); err != nil {\n    if strings.HasPrefix(err.Error(), \"did not parse a single\") {\n        c.logger.Warn(\"no objset metrics parsed\", \"pool\", pool, \"dataset\", ds)\n        return nil\n    }\n    return err\n}","preventionTips":["Confirm the pool/dataset path exists on the host before collecting","Compare against a live 'cat /proc/spl/kstat/zfs/<pool>/objset-*' dump","Watch for ZFS version changes in kstat layout","Log the parsed-file path with the error for debugging"],"tags":["zfs","parsing","objset","empty-result"],"backgroundTag":"empty-result-set","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"}