helm/helm · error

could not load %s: %w

Error message

could not load %s: %w

What it means

Thrown by util.CreateFrom (the engine behind 'helm create --from') when loader.Load(src) fails on the source chart it is supposed to scaffold from. The error wraps the underlying loader failure, so the real cause (missing Chart.yaml, broken archive, bad values) travels with it. src may be a directory, a .tgz, or a URL-referenced chart — anything loader.Load accepts.

Source

Thrown at internal/chart/v3/util/create.go:655

  containers:
    - name: wget
      image: busybox
      command: ['wget']
      args: ['{{ include "<CHARTNAME>.fullname" . }}:{{ .Values.service.port }}']
  restartPolicy: Never
`

// Stderr is an io.Writer to which error messages can be written
//
// In Helm 4, this will be replaced. It is needed in Helm 3 to preserve API backward
// compatibility.
var Stderr io.Writer = os.Stderr

// CreateFrom creates a new chart, but scaffolds it from the src chart.
func CreateFrom(chartfile *chart.Metadata, dest, src string) error {
	schart, err := loader.Load(src)
	if err != nil {
		return fmt.Errorf("could not load %s: %w", src, err)
	}

	schart.Metadata = chartfile

	var updatedTemplates []*common.File

	for _, template := range schart.Templates {
		newData := transform(string(template.Data), schart.Name())
		updatedTemplates = append(updatedTemplates, &common.File{Name: template.Name, ModTime: template.ModTime, Data: newData})
	}

	schart.Templates = updatedTemplates
	b, err := yaml.Marshal(schart.Values)
	if err != nil {
		return fmt.Errorf("reading values file: %w", err)
	}

	var m map[string]any

View on GitHub (pinned to 2a29f1770b)

Solutions

  1. Verify src loads standalone: 'helm show chart <src>' (or 'helm lint <src>') — fix whatever it reports first.
  2. Check the path is the chart root (contains Chart.yaml) or a valid packaged .tgz produced by 'helm package'.
  3. Re-download/re-pull the source if it was fetched (helm pull <repo>/<chart> --version <v>) to rule out corruption.
  4. Once 'helm show chart <src>' succeeds, retry the create --from.

Example fix

# before
$ helm create myapp --from ./myapp-rendered   # rendered manifests, no Chart.yaml
Error: could not load ./myapp-rendered: ...

# after
$ helm create myapp --from ./charts/source-chart   # directory containing Chart.yaml
Defensive patterns

Strategy: validation

Validate before calling

// Validate the --from source before scaffolding.
func srcLoadable(src string) error {
    if fi, err := os.Stat(src); err == nil && fi.IsDir() {
        ok, derr := util.IsChartDir(src)
        if derr != nil || !ok {
            return fmt.Errorf("src dir is not a valid chart: %v", derr)
        }
        return nil
    }
    _, lerr := loader.Load(src) // archives/files
    return lerr
}

Prevention

When it happens

Trigger: CreateFrom(metadata, dest, src) where src is not a loadable chart: directory without Chart.yaml, corrupt or non-chart .tgz, a path with a typo, an empty directory, or a chart whose subcharts/values fail load-time validation.

Common situations: 'helm create myapp --from <path-or-archive>' pointing at a rendered-output directory, a half-downloaded tarball, or a repo layout where the chart is one level deeper than given; scripts passing a values file or repo URL component instead of the chart.

Related errors


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