{"record":{"id":"2ba9b0244fc18597","repo":"prometheus/node_exporter","slug":"sysctl-s-has-no-values","errorCode":null,"errorMessage":"sysctl %s has no values","messagePattern":"sysctl (.+?) has no values","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"collector/sysctl_linux.go","lineNumber":110,"sourceCode":"\t)\n\n\tif s.numeric {\n\t\tvalues, err = c.fs.SysctlInts(s.name)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error obtaining sysctl info: %w\", err)\n\t\t}\n\t\tlength = len(values.([]int))\n\t} else {\n\t\tvalues, err = c.fs.SysctlStrings(s.name)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error obtaining sysctl info: %w\", err)\n\t\t}\n\t\tlength = len(values.([]string))\n\t}\n\n\tswitch length {\n\tcase 0:\n\t\treturn nil, fmt.Errorf(\"sysctl %s has no values\", s.name)\n\tcase 1:\n\t\tif len(s.keys) > 0 {\n\t\t\treturn nil, fmt.Errorf(\"sysctl %s has only one value, but expected %v\", s.name, s.keys)\n\t\t}\n\t\treturn []prometheus.Metric{s.newConstMetric(values)}, nil\n\n\tdefault:\n\n\t\tif len(s.keys) == 0 {\n\t\t\treturn s.newIndexedMetrics(values), nil\n\t\t}\n\n\t\tif length != len(s.keys) {\n\t\t\treturn nil, fmt.Errorf(\"sysctl %s has %d keys but only %d defined in f lag\", s.name, length, len(s.keys))\n\t\t}\n\n\t\treturn s.newMappedMetrics(values)\n\t}","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/sysctl_linux.go#L92-L128","documentation":"Validation guard in newMetrics for the sysctl collector: the sysctl named by s.name resolved successfully but contained zero values (empty int or string list), so no metrics can be built. Typically the kernel returns an empty multi-value sysctl, or the configured sysctl name points at a node that has no payload on this kernel.","triggerScenarios":"Reading a sysctl file that exists but is empty (e.g. some tunables expose empty content until written), producing len==0 from SysctlInts/SysctlStrings.","commonSituations":"Namespaced sysctls in containers that report empty values; driver-specific sysctls empty on this hardware.","solutions":["Check the sysctl manually: `sysctl <name>` — if it is empty or not applicable, remove it from the collector's sysctl list.","Verify the sysctl exists on this kernel version; use a platform-appropriate name.","Report upstream if a standard sysctl legitimately returns zero values."],"exampleFix":"// before\n--collector.sysctl.include='net.ipv4.unused_empty'\n// after\n--collector.sysctl.include='net.ipv4.ip_forward'","handlingStrategy":"fallback","validationCode":"data, _ := os.ReadFile(filepath.Join(\"/proc/sys\", strings.ReplaceAll(name, \".\", \"/\"))); if len(bytes.Fields(data)) == 0 { /* empty: skip */ }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"has no values\") { /* fall back to another metric or ignore */ }","preventionTips":["Check file content is non-empty before adding a sysctl to the include filter","Avoid sysctls that are empty until written by admin tooling","Handle containerized/name-spaced environments where values may be blank"],"tags":["linux","sysctl","empty-value","configuration"],"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"}