abiosoft/colima · warning

error watching directory recursively '%s': %w

Error message

error watching directory recursively '%s': %w

What it means

Watch registers each cleaned directory with rjeczalik/notify for recursive write events using the 'dir/...' syntax. Failure wraps as "error watching directory recursively '<dir>'" with the notify error attached. Typical causes: the directory no longer exists (a container volume deleted after discovery), permission denied for the daemon, or OS-level watch/FSEvents resource errors. Like 114 it returns to the goroutine and is logged, not fatal.

Source

Thrown at daemon/process/inotify/watch.go:40

}

type defaultWatcher struct {
	log *logrus.Entry
}

// Watch implements dirWatcher
func (d *defaultWatcher) Watch(ctx context.Context, dirs []string, mod chan<- modEvent) error {
	log := d.log
	c := make(chan notify.EventInfo, 1)

	for _, dir := range dirs {
		dir, err := util.CleanPath(dir)
		if err != nil {
			return fmt.Errorf("invalid directory: %w", err)
		}
		err = notify.Watch(dir+"...", c, notify.Write)
		if err != nil {
			return fmt.Errorf("error watching directory recursively '%s': %w", dir, err)
		}
	}

	go func(ctx context.Context, c chan notify.EventInfo, mod chan<- modEvent) {
		for {
			select {

			case <-ctx.Done():
				notify.Stop(c)
				log.Trace("stopping watcher")
				if err := ctx.Err(); err != nil {
					log.Trace(fmt.Errorf("error found in ctx: %w", err))
					return
				}

			case e := <-c:
				path := e.Path()

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. read the wrapped errno: 'no such file or directory' means recreate or let the next refresh drop the dir; 'permission denied' means fix access
  2. restart colima if watchers stop tracking new volume sets
  3. raise watch/file descriptor limits if the cause is resource exhaustion
Defensive patterns

Strategy: retry

Validate before calling

for _, dir := range dirs {
    if fi, err := os.Stat(dir); err != nil || !fi.IsDir() {
        continue // pruned/deleted volume: skip rather than fail registration
    }
    _ = notify.Watch(dir+"...", c, notify.Write)
}

Try / catch

if err := notify.Watch(dir+"...", c, notify.Write); err != nil {
    if os.IsNotExist(err) {
        continue // volume vanished: next 5s refresh drops it
    }
    return fmt.Errorf("error watching directory recursively '%s': %w", dir, err)
}

Prevention

When it happens

Trigger: volume directory deleted or renamed between the volume poll and watch registration; permissions blocking the (root) daemon; macOS FSEvents registration failure; watch limit exhaustion on Linux-style inotify backends.

Common situations: `docker volume prune` or workload cleanup while the inotify daemon runs; containers with ephemeral mounts; systems with many concurrent watchers.

Related errors


AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15). Data as JSON: /api/errors/cd876d8f8a102d6c. Report an issue: GitHub.