abiosoft/colima · warning

error running watcher: %w

Error message

error running watcher: %w

What it means

Whenever the polled set of container volumes changes, events.go spawns a detached goroutine running watcher.Watch (after a 1s delayed cancel of the previous watcher). A failure inside that goroutine cannot return to the caller, so it is only logged: 'error running watcher: <cause>'. The observable effect is degraded file-change syncing until the next volume refresh spawns a replacement watcher — the daemon keeps running.

Source

Thrown at daemon/process/inotify/events.go:73

		case vols := <-vols:
			if !volsChanged(vols) {
				continue
			}
			log.Tracef("volumes changed from: %+v, to: %+v", currentVols, vols)

			currentVols = vols

			if cancel := cancelWatch; cancel != nil {
				// delay a bit to avoid zero downtime
				time.AfterFunc(time.Second*1, cancel)
			}

			ctx, cancel := context.WithCancel(ctx)
			cancelWatch = cancel

			go func(ctx context.Context, vols []string, mod chan<- modEvent) {
				if err := watcher.Watch(ctx, vols, mod); err != nil {
					log.Error(fmt.Errorf("error running watcher: %w", err))
				}
			}(ctx, vols, mod)

		// handle modification events
		case ev := <-mod:
			now := time.Now()

			// rate limit, handle at most 50 unique items every 500 ms
			if now.Sub(last) < time.Millisecond*500 {
				if _, ok := cache[ev.path]; ok {
					continue // handled, ignore
				}
				if len(cache) > 50 {
					continue
				}
			} else {
				last = now
				cache = map[string]struct{}{} // >500ms, reset unique cache

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. read the wrapped cause on the same log line to identify the failing directory
  2. remove/recreate the offending container or volume, then let the 5s volume poll re-spawn a watcher, or restart colima
  3. if the cause is resource exhaustion, raise file-handle/watch limits (ulimit, launchctl) and restart
Defensive patterns

Strategy: retry

Try / catch

// inside a custom dirWatcher wrapper
go func(ctx context.Context, vols []string, mod chan<- modEvent) {
    if err := watcher.Watch(ctx, vols, mod); err != nil {
        log.Error(fmt.Errorf("error running watcher: %w", err))
        // no rethrow: the next volume refresh (5s poll) spawns a replacement
    }
}(ctx, vols, mod)

Prevention

When it happens

Trigger: notify.Watch fails to register a recursive watch for one of the volume dirs: the directory was deleted, permission denied, or an OS-level FSEvents/watch-resource error; the wrapped cause comes from Watch ('invalid directory' or "error watching directory recursively '<dir>'").

Common situations: containers with bind-mount sources removed while running; environments with very many watched directories hitting OS limits; paths inaccessible to the root daemon.

Related errors


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