prometheus/node_exporter · error

mapped sysctl string values not supported

Error message

mapped sysctl string values not supported

What it means

newMappedMetrics supports mapping only numeric ([]int) values to user-defined keys; when the value type is []string, mapping is explicitly unsupported and this error is returned. String sysctls must be exported unmapped.

Solutions

  1. Remove the key list so the string sysctl is handled by the scalar path
  2. Drop the string sysctl from the include filter if labels are required
  3. Contribute string mapping support upstream if truly needed

Example fix

// before
--collector.sysctl.include='kernel.domainname:foo,bar'
// after
--collector.sysctl.include='kernel.domainname'
Defensive patterns

Strategy: validation

Validate before calling

if strings.Contains(string(data), " ") && !isNumeric(data) { /* string sysctl: do not configure keys */ }

Try / catch

if err != nil && strings.Contains(err.Error(), "mapped sysctl string values not supported") { /* drop keys from this entry */ }

Prevention

When it happens

Trigger: Configuring a string sysctl (one read via SysctlStrings) together with multiple keys in the include flag, routing it into the mapped-metrics path.

Common situations: Trying to attach named labels to a string-valued sysctl like kernel.domainname; assuming mapped metrics work for all types.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at collector/sysctl_linux.go:214

}

func (s *sysctl) newMappedMetrics(v any) ([]prometheus.Metric, error) {
	switch values := v.(type) {
	case []int:
		metrics := make([]prometheus.Metric, len(values))
		for i, n := range values {
			key := s.keys[i]
			desc := prometheus.NewDesc(
				prometheus.BuildFQName(namespace, "sysctl", s.metricName()+"_"+key),
				fmt.Sprintf("sysctl %s, field %d", s.name, i),
				nil,
				nil,
			)
			metrics[i] = prometheus.MustNewConstMetric(desc, prometheus.UntypedValue, float64(n))
		}
		return metrics, nil
	case []string:
		return nil, fmt.Errorf("mapped sysctl string values not supported")
	default:
		return nil, fmt.Errorf("unexpected type %T", values)
	}
}

View on GitHub (pinned to 17ddd77c59)