{"record":{"id":"d21ba6afac974011","repo":"GoogleContainerTools/skaffold","slug":"didn-t-sync-any-files","errorCode":null,"errorMessage":"didn't sync any files","messagePattern":"didn't sync any files","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/skaffold/sync/sync.go","lineNumber":375,"sourceCode":"\t\t\t\t}\n\n\t\t\t\tcmd := cmdFn(ctx, p, c, files)\n\t\t\t\terrs.Go(func() error {\n\t\t\t\t\t_, err := util.RunCmdOut(ctx, cmd)\n\t\t\t\t\treturn err\n\t\t\t\t})\n\t\t\t\tnumSynced++\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := errs.Wait(); err != nil {\n\t\treturn err\n\t}\n\n\tif numSynced == 0 {\n\t\tlog.Entry(ctx).Warnf(\"sync failed for artifact %q\", image)\n\t\treturn errors.New(\"didn't sync any files\")\n\t}\n\treturn nil\n}\n\nfunc Init(ctx context.Context, artifacts []*latest.Artifact) error {\n\tfor _, a := range artifacts {\n\t\tif a.Sync == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tif a.Sync.Auto != nil && a.JibArtifact != nil {\n\t\t\terr := jib.InitSync(ctx, a.Workspace, a.JibArtifact)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to initialize sync state for %q: %w\", a.ImageName, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/sync/sync.go#L357-L393","documentation":"Skaffold's file sync copies changed files into running containers instead of rebuilding. Perform() fans out copy/delete work in an errgroup and counts synced items; if zero files were actually synced, it logs a per-artifact warning and returns \"didn't sync any files\" so callers (e.g. dev loop) can fall back to a rebuild.","triggerScenarios":"All changed files matched no sync rule (no `sync:` section or manual/infer patterns exclude them); the files were deleted-only with no matching container paths; container runtime rejected every copy so numSynced stayed 0; syncing to a workload not actually running.","commonSituations":"Editing files outside configured sync paths; inferred sync failing for languages whose built artifacts (e.g. compiled binaries) don't map to source files; Kubernetes pod not running when dev triggers sync; Windows path separator mismatches in sync patterns.","solutions":["Add or widen a `sync:` section for the artifact (manual: with glob patterns, or infer:) covering the changed files.","Ensure the target deployment/pod is running so the sync target exists.","If sync isn't appropriate for that change, accept the rebuild — Skaffold falls back to rebuilding on this error.","Check sync pattern spelling and that patterns are relative to the artifact's workspace."],"exampleFix":"# before\nbuild:\n  artifacts:\n    - image: myapp\n      context: .\n# after\nbuild:\n  artifacts:\n    - image: myapp\n      context: .\n      sync:\n        manual:\n          - src: \"src/**/*.js\"\n            dest: ./app/src/","handlingStrategy":"fallback","validationCode":"const patterns = artifact.sync?.manual?.map(m => m.src) ?? [];\nconst affected = changedFiles.filter(f => patterns.some(p => minimatch(f, p)));\nif (affected.length === 0) console.log('no files match sync rules; rebuild will occur');","typeGuard":null,"tryCatchPattern":"try {\n  await skaffoldDev();\n} catch (e) {\n  if (String(e).includes(\"didn't sync any files\")) await skaffoldBuildAndDeploy(); // fallback to rebuild\n}","preventionTips":["Define explicit sync: manual patterns for each artifact","Keep edited files inside the artifact workspace and matched globs","Ensure the target workload is running before editing files in dev mode"],"tags":["skaffold","file-sync","dev-loop"],"backgroundTag":"file-sync-no-op","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"}