prometheus/node_exporter · error

textfile contains unsupported client-side timestamps…

Error message

textfile %q contains unsupported client-side timestamps, skipping entire file

What it means

The textfile collector deliberately rejects metric families that carry client-side timestamps, because they conflict with node_exporter's scrape-time semantics and can produce stale/incorrect data in Prometheus. If hasTimestamps(families) is true, processFile fails with this error and the entire file is skipped.

Solutions

  1. Strip the timestamp field from every sample line the producing script writes
  2. Regenerate files without timestamps (third column must be omitted in the exposition format)
  3. If timestamps are essential, push those metrics via Pushgateway instead of the textfile collector
  4. Audit all *.prom writers in the directory — one offending file removes its metrics from the scrape

Example fix

// before
my_metric 42 1727000000000
// after
my_metric 42
Defensive patterns

Strategy: validation

Validate before calling

data, _ := os.ReadFile(filepath.Join(dir, name))
for _, line := range strings.Split(string(data), "\n") {
    fields := strings.Fields(line)
    if len(fields) > 2 && !strings.HasPrefix(line, "#") {
        log.Warn("sample has client-side timestamp", "line", line)
    }
}

Try / catch

if err := coll.Update(ch); err != nil {
    if strings.Contains(err.Error(), "unsupported client-side timestamps") {
        log.Warn("remove timestamps from textfile", "err", err)
    }
}

Prevention

When it happens

Trigger: A textfile contains samples with an explicit timestamp field, e.g. `my_metric 1 1690000000000`, detected by hasTimestamps on the parsed families.

Common situations: Scripts generated by other exporters/formats that include timestamps; users copying pushgateway-style output with timestamps; tools writing OpenMetrics-ish output with explicit ms timestamps into the textfile directory.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at collector/textfile.go:303

}

// processFile processes a single file, returning its modification time on success.
func (c *textFileCollector) processFile(dir, name string) (*time.Time, map[string]*dto.MetricFamily, error) {
	path := filepath.Join(dir, name)
	f, err := os.Open(path)
	if err != nil {
		return nil, nil, fmt.Errorf("failed to open textfile data file %q: %w", path, err)
	}
	defer f.Close()

	parser := expfmt.NewTextParser(model.UTF8Validation)
	families, err := parser.TextToMetricFamilies(f)
	if err != nil {
		return nil, nil, fmt.Errorf("failed to parse textfile data from %q: %w", path, err)
	}

	if hasTimestamps(families) {
		return nil, nil, fmt.Errorf("textfile %q contains unsupported client-side timestamps, skipping entire file", path)
	}

	// Only stat the file once it has been parsed and validated, so that
	// a failure does not appear fresh.
	stat, err := f.Stat()
	if err != nil {
		return nil, families, fmt.Errorf("failed to stat %q: %w", path, err)
	}

	t := stat.ModTime()
	return &t, families, nil
}

// hasTimestamps returns true when metrics contain unsupported timestamps.
func hasTimestamps(parsedFamilies map[string]*dto.MetricFamily) bool {
	for _, mf := range parsedFamilies {
		for _, m := range mf.Metric {
			if m.TimestampMs != nil {

View on GitHub (pinned to 17ddd77c59)