thanos-io/thanos · error

dir symlink eval

Error message

dir symlink eval

What it means

apply fails when filepath.EvalSymlinks cannot resolve the watched rule directory or its output directory — the symlink is dangling or the directory was removed — so directory hashing and reload abort for this cycle.

Solutions

  1. Ensure the rule directory symlink targets an existing path.
  2. Re-create the mount/configmap if deleted.
  3. Inspect the wrapped error to see which path failed.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pkg/reloader/reloader.go:428 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/0915fd0a7dbf3998. Report an issue: GitHub.

Appendix: source

Thrown at pkg/reloader/reloader.go:428

		if err := hashFile(h, r.cfgFile); err != nil {
			return errors.Wrap(err, "hash file")
		}
		cfgHash = h.Sum(nil)
		if r.cfgOutputFile != "" {
			if err := r.normalize(r.cfgFile, r.cfgOutputFile); err != nil {
				return err
			}
		}
	}

	cfgDirsHash := make([][]byte, len(r.cfgDirs))
	cfgDirsChanged := len(r.lastCfgDirsHash) == 0 && len(r.cfgDirs) > 0
	for i, cfgDir := range r.cfgDirs {
		h := sha256.New()

		walkDir, err := filepath.EvalSymlinks(cfgDir.Dir)
		if err != nil {
			return errors.Wrap(err, "dir symlink eval")
		}
		outDir, err := filepath.EvalSymlinks(cfgDir.OutputDir)
		if err != nil {
			return errors.Wrap(err, "dir symlink eval")
		}

		cfgDirFiles := map[string]struct{}{}
		entries, err := os.ReadDir(walkDir)
		if err != nil {
			return errors.Wrapf(err, "read dir: %s", walkDir)
		}
		for _, entry := range entries {
			path := filepath.Join(walkDir, entry.Name())

			// Make sure to follow a symlink before checking if it is a directory.
			targetFile, err := os.Stat(path)
			if err != nil {
				return errors.Wrapf(err, "stat file: %s", path)

View on GitHub (pinned to 35b8b99117)