GoogleContainerTools/skaffold · warning

didn't sync any files

Error message

didn't sync any files

What it means

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.

Source

Thrown at pkg/skaffold/sync/sync.go:375

				}

				cmd := cmdFn(ctx, p, c, files)
				errs.Go(func() error {
					_, err := util.RunCmdOut(ctx, cmd)
					return err
				})
				numSynced++
			}
		}
	}

	if err := errs.Wait(); err != nil {
		return err
	}

	if numSynced == 0 {
		log.Entry(ctx).Warnf("sync failed for artifact %q", image)
		return errors.New("didn't sync any files")
	}
	return nil
}

func Init(ctx context.Context, artifacts []*latest.Artifact) error {
	for _, a := range artifacts {
		if a.Sync == nil {
			continue
		}

		if a.Sync.Auto != nil && a.JibArtifact != nil {
			err := jib.InitSync(ctx, a.Workspace, a.JibArtifact)
			if err != nil {
				return fmt.Errorf("failed to initialize sync state for %q: %w", a.ImageName, err)
			}
		}
	}
	return nil

View on GitHub (pinned to a1189de023)

Solutions

  1. Add or widen a `sync:` section for the artifact (manual: with glob patterns, or infer:) covering the changed files.
  2. Ensure the target deployment/pod is running so the sync target exists.
  3. If sync isn't appropriate for that change, accept the rebuild — Skaffold falls back to rebuilding on this error.
  4. Check sync pattern spelling and that patterns are relative to the artifact's workspace.

Example fix

# before
build:
  artifacts:
    - image: myapp
      context: .
# after
build:
  artifacts:
    - image: myapp
      context: .
      sync:
        manual:
          - src: "src/**/*.js"
            dest: ./app/src/
Defensive patterns

Strategy: fallback

Validate before calling

const patterns = artifact.sync?.manual?.map(m => m.src) ?? [];
const affected = changedFiles.filter(f => patterns.some(p => minimatch(f, p)));
if (affected.length === 0) console.log('no files match sync rules; rebuild will occur');

Try / catch

try {
  await skaffoldDev();
} catch (e) {
  if (String(e).includes("didn't sync any files")) await skaffoldBuildAndDeploy(); // fallback to rebuild
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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