GoogleContainerTools/skaffold · error

watching skaffold configuration %q: %w

Error message

watching skaffold configuration %q: %w

What it means

Dev() watches the skaffold.yaml configuration file itself so changes trigger a reload. If registering that single file with the monitor fails, Skaffold emits DEVINIT_REGISTER_CONFIG_DEP and returns 'watching skaffold configuration <path>'. Registration here rarely fails from the dependency function (it returns a constant path); failures come from the file monitor itself.

Source

Thrown at pkg/skaffold/runner/dev.go:455

	if err := r.monitor.Register(
		r.deployer.Dependencies,
		func(filemon.Events) { r.changeSet.Redeploy() },
	); err != nil {
		event.DevLoopFailedWithErrorCode(r.devIteration, proto.StatusCode_DEVINIT_REGISTER_DEPLOY_DEPS, err)
		eventV2.TaskFailed(constants.DevLoop, err)
		endTrace()
		return fmt.Errorf("watching files for deployer: %w", err)
	}

	// Watch Skaffold configuration
	if err := r.monitor.Register(
		func() ([]string, error) { return []string{r.runCtx.ConfigurationFile()}, nil },
		func(filemon.Events) { r.changeSet.Reload() },
	); err != nil {
		event.DevLoopFailedWithErrorCode(r.devIteration, proto.StatusCode_DEVINIT_REGISTER_CONFIG_DEP, err)
		eventV2.TaskFailed(constants.DevLoop, err)
		endTrace()
		return fmt.Errorf("watching skaffold configuration %q: %w", r.runCtx.ConfigurationFile(), err)
	}

	log.Entry(ctx).Infoln("List generated in", timeutil.Humanize(time.Since(start)))
	log.Entry(ctx).Infoln("Dev loop completed in", timeutil.Humanize(time.Since(devStart)))

	// Init Sync State
	if err := sync.Init(ctx, artifacts); err != nil {
		event.DevLoopFailedWithErrorCode(r.devIteration, proto.StatusCode_SYNC_INIT_ERROR, err)
		eventV2.TaskFailed(constants.DevLoop, err)
		endTrace()
		return fmt.Errorf("exiting dev mode because initializing sync state failed: %w", err)
	}

	output.Yellow.Fprintln(out, "Press Ctrl+C to exit")

	event.DevLoopComplete(r.devIteration)
	eventV2.TaskSucceeded(constants.DevLoop)
	endTrace()

View on GitHub (pinned to a1189de023)

Solutions

  1. Confirm skaffold.yaml exists at the path shown in the error message
  2. Raise inotify limits: `sysctl fs.inotify.max_user_watches=524288` and `max_user_instances`
  3. Avoid running the watcher on network filesystems that don't support file events
  4. Re-run `skaffold dev` from the project root

Example fix

// before: run from wrong directory
$ skaffold dev -f configs/skaffold.yaml  # file moved
// after
$ cd project-root && skaffold dev
Defensive patterns

Strategy: validation

Validate before calling

// ensure the config file exists and is on a watchable FS
if _, err := os.Stat("skaffold.yaml"); err != nil {
    return fmt.Errorf("skaffold.yaml not found in cwd")
}

Prevention

When it happens

Trigger: `r.monitor.Register(func() { return []string{r.runCtx.ConfigurationFile()}, nil }, ...)` errors — typically the watcher cannot add the config file path (file deleted mid-init, watch descriptor exhaustion, unsupported filesystem).

Common situations: skaffold.yaml deleted or renamed while dev initializes; running on a filesystem that doesn't support inotify/fsnotify (some network mounts); fs.inotify.max_user_watches exhausted.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/08d9d8d17463bdf7. Report an issue: GitHub.