GoogleContainerTools/skaffold · error

watching test files: %w

Error message

watching test files: %w

What it means

Dev() registers test dependencies so changed files trigger re-tests. If r.tester.TestDependencies or the monitor registration for an artifact fails, Skaffold emits DEVINIT_REGISTER_TEST_DEPS and returns 'watching test files'. This aborts dev mode before the watch loop starts.

Source

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

				event.DevLoopFailedWithErrorCode(r.devIteration, proto.StatusCode_DEVINIT_REGISTER_BUILD_DEPS, err)
				eventV2.TaskFailed(constants.DevLoop, err)
				endTrace()
				return fmt.Errorf("watching files for artifact %q: %w", artifact.ImageName, err)
			}
		}
	}

	// Watch test configuration
	for i := range artifacts {
		artifact := artifacts[i]
		if err := r.monitor.Register(
			func() ([]string, error) { return r.tester.TestDependencies(ctx, artifact) },
			func(filemon.Events) { r.changeSet.AddRetest(artifact) },
		); err != nil {
			event.DevLoopFailedWithErrorCode(r.devIteration, proto.StatusCode_DEVINIT_REGISTER_TEST_DEPS, err)
			eventV2.TaskFailed(constants.DevLoop, err)
			endTrace()
			return fmt.Errorf("watching test files: %w", err)
		}
	}

	// Watch render configuration
	if err := r.monitor.Register(
		r.renderer.ManifestDeps,
		func(filemon.Events) { r.changeSet.Redeploy() },
	); err != nil {
		event.DevLoopFailedWithErrorCode(r.devIteration, proto.StatusCode_DEVINIT_REGISTER_RENDER_DEPS, err)
		eventV2.TaskFailed(constants.DevLoop, err)
		endTrace()
		return fmt.Errorf("watching files for renderer: %w", err)
	}

	// Watch deployment configuration
	if err := r.monitor.Register(
		r.deployer.Dependencies,
		func(filemon.Events) { r.changeSet.Redeploy() },

View on GitHub (pinned to a1189de023)

Solutions

  1. Inspect the wrapped error to find which test dependency path failed to resolve
  2. Remove or correct the `test:` stanza in skaffold.yaml referencing missing files
  3. Ensure test fixture files exist and are readable
  4. Raise inotify watch limits if the error is watcher exhaustion

Example fix

// before
test:
  - image: app
    custom:
      - command: ./scripts/missing-test.sh
// after
test:
  - image: app
    custom:
      - command: ./scripts/run-tests.sh
Defensive patterns

Strategy: validation

Validate before calling

// validate test stanza targets exist
for _, t := range cfg.Test {
    for _, c := range t.CustomTests {
        if _, err := os.Stat(c.Command); err != nil {
            log.Printf("test command not found for %s: %s", t.ImageName, c.Command)
        }
    }
}

Prevention

When it happens

Trigger: `r.monitor.Register(func() { return r.tester.TestDependencies(ctx, artifact) }, ...)` errors — the test configuration's dependency discovery fails (e.g. a test hook script or referenced file cannot be enumerated) or the watcher registration fails.

Common situations: Test configuration in skaffold.yaml references files that don't exist; custom test command's dependency listing fails; permission errors reading test fixtures; inotify watch exhaustion.

Related errors


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