{"record":{"id":"555f7437bf104e4d","repo":"GoogleContainerTools/skaffold","slug":"watching-files-for-artifact-q-w","errorCode":null,"errorMessage":"watching files for artifact %q: %w","messagePattern":"watching files for artifact %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/runner/dev.go","lineNumber":406,"sourceCode":"\t\t\t\tfunc() ([]string, error) {\n\t\t\t\t\treturn r.sourceDependencies.TransitiveArtifactDependencies(ctx, artifact)\n\t\t\t\t},\n\t\t\t\tfunc(e filemon.Events) {\n\t\t\t\t\ts, err := sync.NewItem(ctx, artifact, e, r.Builds, r.runCtx, len(g[artifact.ImageName]))\n\t\t\t\t\tswitch {\n\t\t\t\t\tcase err != nil:\n\t\t\t\t\t\tlog.Entry(ctx).Warnf(\"error adding dirty artifact to changeset: %s\", err.Error())\n\t\t\t\t\tcase s != nil:\n\t\t\t\t\t\tr.changeSet.AddResync(s)\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tr.changeSet.AddRebuild(artifact)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t); err != nil {\n\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","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/runner/dev.go#L388-L424","documentation":"Dev() registers build dependencies for each artifact with the file monitor via r.monitor.Register. If computing or registering the watch set for an artifact fails, Skaffold emits DEVINIT_REGISTER_BUILD_DEPS and aborts with 'watching files for artifact <image>'. The failure comes from the artifact's BuildDependencies() (e.g. enumerating source files) or the monitor's registration.","triggerScenarios":"`r.monitor.Register(artifact.Dependencies, ...)` (inside RegisterBuildDependencies) returns an error for a specific artifact.ImageName — typically when resolving the artifact's build context file list fails (unreadable directories, bad sync/workspace globs) or the watcher cannot be created.","commonSituations":"Build context directory deleted or unreadable (permissions); Dockerfile referenced by the artifact missing; file watcher limit (inotify watches) exhausted; a workspace path in skaffold.yaml points outside the repo.","solutions":["Fix the artifact path/globs in skaffold.yaml so the build context resolves","Check the wrapped error for which file or directory is unreadable and restore permissions","Raise inotify watch limits: `sysctl fs.inotify.max_user_watches=524288`","Re-run `skaffold dev`"],"exampleFix":"// before (skaffold.yaml)\nartifacts:\n  - image: app\n    context: ./src/app   # directory removed\n// after\nartifacts:\n  - image: app\n    context: .","handlingStrategy":"validation","validationCode":"// verify every artifact build context resolves before dev\nfor _, a := range cfg.Build.Artifacts {\n    if _, err := os.Stat(a.Workspace); err != nil {\n        return fmt.Errorf(\"artifact %q workspace missing: %w\", a.ImageName, err)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep artifact contexts inside the repo and committed","Check fs.inotify.max_user_watches on dev machines","Avoid symlinks into unreadable directories","Run `skaffold build` first to exercise dependency enumeration"],"tags":["skaffold","file-watch","dev-loop","build"],"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"}