{"record":{"id":"675efb365edbcd44","repo":"prometheus/node_exporter","slug":"textfile-q-contains-unsupported-client-side-times","errorCode":null,"errorMessage":"textfile %q contains unsupported client-side timestamps, skipping entire file","messagePattern":"textfile %q contains unsupported client-side timestamps, skipping entire file","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/textfile.go","lineNumber":303,"sourceCode":"}\n\n// processFile processes a single file, returning its modification time on success.\nfunc (c *textFileCollector) processFile(dir, name string) (*time.Time, map[string]*dto.MetricFamily, error) {\n\tpath := filepath.Join(dir, name)\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to open textfile data file %q: %w\", path, err)\n\t}\n\tdefer f.Close()\n\n\tparser := expfmt.NewTextParser(model.UTF8Validation)\n\tfamilies, err := parser.TextToMetricFamilies(f)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to parse textfile data from %q: %w\", path, err)\n\t}\n\n\tif hasTimestamps(families) {\n\t\treturn nil, nil, fmt.Errorf(\"textfile %q contains unsupported client-side timestamps, skipping entire file\", path)\n\t}\n\n\t// Only stat the file once it has been parsed and validated, so that\n\t// a failure does not appear fresh.\n\tstat, err := f.Stat()\n\tif err != nil {\n\t\treturn nil, families, fmt.Errorf(\"failed to stat %q: %w\", path, err)\n\t}\n\n\tt := stat.ModTime()\n\treturn &t, families, nil\n}\n\n// hasTimestamps returns true when metrics contain unsupported timestamps.\nfunc hasTimestamps(parsedFamilies map[string]*dto.MetricFamily) bool {\n\tfor _, mf := range parsedFamilies {\n\t\tfor _, m := range mf.Metric {\n\t\t\tif m.TimestampMs != nil {","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/textfile.go#L285-L321","documentation":"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.","triggerScenarios":"A textfile contains samples with an explicit timestamp field, e.g. `my_metric 1 1690000000000`, detected by hasTimestamps on the parsed families.","commonSituations":"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.","solutions":["Strip the timestamp field from every sample line the producing script writes","Regenerate files without timestamps (third column must be omitted in the exposition format)","If timestamps are essential, push those metrics via Pushgateway instead of the textfile collector","Audit all *.prom writers in the directory — one offending file removes its metrics from the scrape"],"exampleFix":"// before\nmy_metric 42 1727000000000\n// after\nmy_metric 42","handlingStrategy":"validation","validationCode":"data, _ := os.ReadFile(filepath.Join(dir, name))\nfor _, line := range strings.Split(string(data), \"\\n\") {\n    fields := strings.Fields(line)\n    if len(fields) > 2 && !strings.HasPrefix(line, \"#\") {\n        log.Warn(\"sample has client-side timestamp\", \"line\", line)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := coll.Update(ch); err != nil {\n    if strings.Contains(err.Error(), \"unsupported client-side timestamps\") {\n        log.Warn(\"remove timestamps from textfile\", \"err\", err)\n    }\n}","preventionTips":["Never emit a third (timestamp) column in textfile samples","Use Pushgateway when timestamps are genuinely required","Sanitize third-party exporter output before dropping it into the textfile dir","Add a lint step for .prom files that flags timestamped samples"],"tags":["textfile","prometheus","timestamps","exposition-format"],"backgroundTag":"schema-validation-failed","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"}