kataras/iris · error

walk stat: %s: %w

Error message

walk stat: %s: %w

What it means

During the same fs.WalkDir traversal, the walker calls d.Info() to stat each entry. If Info fails for a reason other than filepath.SkipDir (which is intentionally tolerated), the error is wrapped as 'walk stat: <path>: <err>' so the caller knows statting — not walking — failed on that specific path.

Source

Thrown at view/fs.go:33

		if err != nil {
			return err
		}
		fileSystem = sub
	}

	if root == "" {
		root = "."
	}

	return fs.WalkDir(fileSystem, root, func(path string, d fs.DirEntry, err error) error {
		if err != nil {
			return fmt.Errorf("walk: %s: %w", path, err)
		}

		info, err := d.Info()
		if err != nil {
			if err != filepath.SkipDir {
				return fmt.Errorf("walk stat: %s: %w", path, err)
			}

			return nil
		}

		if info.IsDir() {
			return nil
		}

		walkFnErr := walkFn(path, info, err)
		if walkFnErr != nil {
			return fmt.Errorf("walk: walkFn: %w", walkFnErr)
		}

		return nil
	})

}

View on GitHub (pinned to 7bedaf55a0)

Solutions

  1. Re-run the load after the file churn settles (or disable hot reload during deploys).
  2. Remove or fix broken symlinks in the views tree.
  3. Grant read permissions on all entries under the root.
  4. If the inner error is genuinely transient, retry; otherwise fix the FS contents as reported by the path.

Example fix

// before (views contains broken symlink)
ln -s /nonexistent views/missing.html
// after
rm views/missing.html
Defensive patterns

Strategy: retry

Validate before calling

entries, err := os.ReadDir(root)
if err != nil { return err }
for _, e := range entries {
    if e.Type()&fs.ModeSymlink != 0 { // broken symlink guard
        if _, err := os.Stat(filepath.Join(root, e.Name())); err != nil {
            return fmt.Errorf("broken entry %s: %w", e.Name(), err)
        }
    }
}

Try / catch

if err := loadViews(); err != nil {
    if strings.Contains(err.Error(), "walk stat:") {
        time.Sleep(200 * time.Millisecond) // transient during deploys
        return loadViews()
    }
    return err
}

Prevention

When it happens

Trigger: fs.DirEntry.Info() returns an error mid-walk, typically when a file is deleted or a symlink target vanishes between directory read and stat, or on permission-restricted entries in some custom FS implementations.

Common situations: Racing template hot-reload while files are being replaced/removed; broken symlinks inside the views folder; virtual/embedded FS implementations that can't resolve an entry.

Related errors


AI-assisted analysis of kataras/iris@7bedaf55a0 (2026-08-30). Data as JSON: /api/errors/124d37cecfc91820. Report an issue: GitHub.