{"record":{"id":"b23bb3c20e479b2b","repo":"GoogleContainerTools/skaffold","slug":"watching-test-files-w","errorCode":null,"errorMessage":"watching test files: %w","messagePattern":"watching test files: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/runner/dev.go","lineNumber":421,"sourceCode":"\t\t\t\tevent.DevLoopFailedWithErrorCode(r.devIteration, proto.StatusCode_DEVINIT_REGISTER_BUILD_DEPS, err)\n\t\t\t\teventV2.TaskFailed(constants.DevLoop, err)\n\t\t\t\tendTrace()\n\t\t\t\treturn fmt.Errorf(\"watching files for artifact %q: %w\", artifact.ImageName, err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Watch test configuration\n\tfor i := range artifacts {\n\t\tartifact := artifacts[i]\n\t\tif err := r.monitor.Register(\n\t\t\tfunc() ([]string, error) { return r.tester.TestDependencies(ctx, artifact) },\n\t\t\tfunc(filemon.Events) { r.changeSet.AddRetest(artifact) },\n\t\t); err != nil {\n\t\t\tevent.DevLoopFailedWithErrorCode(r.devIteration, proto.StatusCode_DEVINIT_REGISTER_TEST_DEPS, err)\n\t\t\teventV2.TaskFailed(constants.DevLoop, err)\n\t\t\tendTrace()\n\t\t\treturn fmt.Errorf(\"watching test files: %w\", err)\n\t\t}\n\t}\n\n\t// Watch render configuration\n\tif err := r.monitor.Register(\n\t\tr.renderer.ManifestDeps,\n\t\tfunc(filemon.Events) { r.changeSet.Redeploy() },\n\t); err != nil {\n\t\tevent.DevLoopFailedWithErrorCode(r.devIteration, proto.StatusCode_DEVINIT_REGISTER_RENDER_DEPS, err)\n\t\teventV2.TaskFailed(constants.DevLoop, err)\n\t\tendTrace()\n\t\treturn fmt.Errorf(\"watching files for renderer: %w\", err)\n\t}\n\n\t// Watch deployment configuration\n\tif err := r.monitor.Register(\n\t\tr.deployer.Dependencies,\n\t\tfunc(filemon.Events) { r.changeSet.Redeploy() },","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/runner/dev.go#L403-L439","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Inspect the wrapped error to find which test dependency path failed to resolve","Remove or correct the `test:` stanza in skaffold.yaml referencing missing files","Ensure test fixture files exist and are readable","Raise inotify watch limits if the error is watcher exhaustion"],"exampleFix":"// before\ntest:\n  - image: app\n    custom:\n      - command: ./scripts/missing-test.sh\n// after\ntest:\n  - image: app\n    custom:\n      - command: ./scripts/run-tests.sh","handlingStrategy":"validation","validationCode":"// validate test stanza targets exist\nfor _, t := range cfg.Test {\n    for _, c := range t.CustomTests {\n        if _, err := os.Stat(c.Command); err != nil {\n            log.Printf(\"test command not found for %s: %s\", t.ImageName, c.Command)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reference only existing test scripts/fixtures in skaffold.yaml","Keep test dependencies inside the watched workspace","Raise inotify instance limits","Lint skaffold.yaml with `skaffold lint` or schema validation"],"tags":["skaffold","file-watch","testing","dev-loop"],"backgroundTag":"file-watch-registration-failed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}