GoogleContainerTools/skaffold · error

cannot find provided file %s

Error message

cannot find provided file %s

What it means

In `skaffold apply` (cmd/skaffold/app/cmd/apply.go:73), validateManifests opens each manifest file passed via the --filepath flag before applying. When os.Open fails with os.ErrNotExist, the command aborts with this error because the file to apply does not exist.

Source

Thrown at cmd/skaffold/app/cmd/apply.go:73

}

func doApply(ctx context.Context, out io.Writer, args []string) error {
	// force set apply boolean to select default options in runner creation
	opts.Apply = true
	opts.HydratedManifests = args
	if err := validateManifests(args); err != nil {
		return err
	}
	return withRunner(ctx, out, func(r runner.Runner, configs []util.VersionedConfig) error {
		return r.Apply(ctx, out)
	})
}

func validateManifests(manifests []string) error {
	for _, m := range manifests {
		if _, err := os.Open(m); err != nil {
			if errors.Is(err, os.ErrNotExist) {
				return fmt.Errorf("cannot find provided file %s", m)
			}
			return fmt.Errorf("unable to open provided file %s", m)
		}

		if _, err := kubernetes.ParseKubernetesObjects(m); err != nil {
			return errors.Wrap(err, fmt.Sprintf("%s is not a valid Kubernetes manifest", m))
		}
	}
	return nil
}

View on GitHub (pinned to a1189de023)

Solutions

  1. Check the path with `ls` and fix any typo in the --filepath argument
  2. Run the command from the directory where the manifest path is valid, or pass an absolute path
  3. Ensure the manifest-generating step (e.g. `skaffold render`) ran and wrote the file before apply
  4. Update the script/CI pipeline to reference the current manifest location

Example fix

// before
// skaffold apply --filepath manifests/deployement.yaml
// after
// skaffold apply --filepath manifests/deployment.yaml
Defensive patterns

Strategy: validation

Validate before calling

// Before running skaffold apply, verify every manifest exists
for _, m := range manifests {
    if _, err := os.Stat(m); os.IsNotExist(err) {
        return fmt.Errorf("manifest missing before apply: %s", m)
    }
}

Try / catch

if err := sh.Run("skaffold", "apply", "--filepath", manifestPath); err != nil {
    if strings.Contains(err.Error(), "cannot find provided file") {
        log.Fatalf("manifest %s does not exist; run render first", manifestPath)
    }
    return err
}

Prevention

When it happens

Trigger: Running `skaffold apply --filepath <file>` (or positional manifest args resolved by doApply) where one of the given paths does not exist on disk; validateManifests iterates the manifests and os.Open returns os.ErrNotExist.

Common situations: Typo in the manifest path; running from a different working directory than expected; manifest was generated into a path that a previous build/render step never produced; deleted or renamed file still referenced in a script/CI job.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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