helm/helm · error

%s: no such file

Error message

%s: no such file

What it means

OCIPusher.push runs os.Stat on the chart reference before pushing; when the stat error is fs.ErrNotExist it returns "<path>: no such file". The chartRef argument must be the path of an existing .tgz chart archive on local disk.

Source

Thrown at pkg/pusher/ocipusher.go:51

// OCIPusher is the default OCI backend handler
type OCIPusher struct {
	opts options
}

// Push performs a Push from repo.Pusher.
func (pusher *OCIPusher) Push(chartRef, href string, options ...Option) error {
	for _, opt := range options {
		opt(&pusher.opts)
	}
	return pusher.push(chartRef, href)
}

func (pusher *OCIPusher) push(chartRef, href string) error {
	stat, err := os.Stat(chartRef)
	if err != nil {
		if errors.Is(err, fs.ErrNotExist) {
			return fmt.Errorf("%s: no such file", chartRef)
		}
		return err
	}
	if stat.IsDir() {
		return errors.New("cannot push directory, must provide chart archive (.tgz)")
	}

	meta, err := loader.Load(chartRef)
	if err != nil {
		return err
	}

	client := pusher.opts.registryClient
	if client == nil {
		c, err := pusher.newRegistryClient()
		if err != nil {
			return err
		}

View on GitHub (pinned to 2a29f1770b)

Solutions

  1. Run ls or os.Stat on the exact path you pass to Push and fix the typo or directory
  2. Use an absolute path, or ensure the process cwd is where the .tgz lives
  3. If the archive does not exist yet, build it first with `helm package <chart-dir>`

Example fix

// before
err := pusher.Push("mychart-1.0.0.tgz", "oci://reg.example.com/charts/mychart")

// after
if _, statErr := os.Stat("mychart-1.0.0.tgz"); statErr != nil {
	return fmt.Errorf("chart archive missing (run `helm package .` first): %w", statErr)
}
err := pusher.Push("mychart-1.0.0.tgz", "oci://reg.example.com/charts/mychart")
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Stat(chartRef); err != nil {
	return fmt.Errorf("refusing to push, chart archive not found: %w", err)
}
err := pusher.Push(chartRef, ociURL)

Prevention

When it happens

Trigger: Calling OCIPusher.Push(chartRef, href) or `helm push chart.tgz oci://...` where chartRef does not exist: a typo in the filename, a relative path resolved from a different working directory, or a package step that never produced the .tgz.

Common situations: CI scripts referencing dist/*.tgz before `helm package` ran; shell globs that expanded to nothing so the literal pattern is passed; running helm from a directory other than where the archive was built.

Related errors


AI-assisted analysis of helm/helm@2a29f1770b (2026-08-15). Data as JSON: /api/errors/46bd84914e0c5f39. Report an issue: GitHub.