thanos-io/thanos · error

read file

Error message

read file

What it means

Wraps os.ReadFile in Reloader.normalize: the Prometheus/rule config input file cannot be read (missing, permission-denied, directory). The reloader cannot produce the normalized output file, so the apply cycle logs an apply error and retries on the next tick.

Solutions

  1. Verify the input file path is mounted and readable.
  2. Check configmap/secret mount timing in Kubernetes.
  3. Inspect the wrapped OS error (ENOENT, EACCES).
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pkg/reloader/reloader.go:364 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of thanos-io/thanos@35b8b99117 (2026-09-07). Data as JSON: /api/errors/101ded11f23ba45f. Report an issue: GitHub.

Appendix: source

Thrown at pkg/reloader/reloader.go:364

		}

		// Reset the watch timeout.
		applyCancel()
		applyCtx, applyCancel = context.WithTimeout(ctx, r.watchInterval)

		r.configApply.Inc()
		if err := r.apply(applyCtx); err != nil {
			r.configApplyErrors.Inc()
			level.Error(r.logger).Log("msg", "apply error", "err", err)
			continue
		}
	}
}

func (r *Reloader) normalize(inputFile, outputFile string) error {
	b, err := os.ReadFile(inputFile)
	if err != nil {
		return errors.Wrap(err, "read file")
	}

	// Detect and extract gzipped file.
	if bytes.Equal(b[0:3], firstGzipBytes) {
		zr, err := gzip.NewReader(bytes.NewReader(b))
		if err != nil {
			return errors.Wrap(err, "create gzip reader")
		}
		defer runutil.CloseWithLogOnErr(r.logger, zr, "gzip reader close")

		b, err = io.ReadAll(zr)
		if err != nil {
			return errors.Wrap(err, "read compressed config file")
		}
	}

	b, err = r.expandEnv(b)
	if err != nil {

View on GitHub (pinned to 35b8b99117)