{"record":{"id":"1b561de61a95b993","repo":"GoogleContainerTools/skaffold","slug":"failed-to-install-helm-plugin","errorCode":null,"errorMessage":"Failed to install Helm plugin","messagePattern":"Failed to install Helm plugin","errorType":"exception","errorClass":"PluginErr","httpStatus":null,"severity":"error","filePath":"pkg/skaffold/helm/bin.go","lineNumber":137,"sourceCode":"\t\thelmPluginDir = PluginInstallDir\n\t}\n\n\t// Take the temporary directory name as unique plugin name. That string is expected to\n\t// be safe for direct %s insertion in the YAML Helm plugin manifest.\n\thelmPluginName := path.Base(helmPluginDir)\n\terr = os.WriteFile(path.Join(helmPluginDir, \"plugin.yaml\"), []byte(fmt.Sprintf(PostRendererTemplate, helmPluginName, skaffoldBinaryAsYaml)), 0644)\n\tif err != nil &&\n\t\t// Don't produce an error in tests that simulate the directory\n\t\t!strings.HasPrefix(PluginInstallDir, \"TEMPORARY-TEST-DIR\") {\n\t\tos.RemoveAll(helmPluginDir)\n\t\treturn nil, nil, PluginErr(\"Failed to write Helm plugin.yaml\", err)\n\t}\n\n\tout := new(bytes.Buffer)\n\terr = Exec(ctx, h, out, false, nil, \"plugin\", \"install\", helmPluginDir)\n\tif err != nil {\n\t\tos.RemoveAll(helmPluginDir)\n\t\treturn nil, nil, PluginErr(\"Failed to install Helm plugin\", errors.New(strings.TrimSpace(out.String())))\n\t}\n\n\tcleanUp := func() {\n\t\tExec(ctx, h, out, false, nil, \"plugin\", \"uninstall\", helmPluginName)\n\t\tos.RemoveAll(helmPluginDir)\n\t}\n\treturn cleanUp, []string{\"--post-renderer\", helmPluginName}, nil\n}\n\nfunc PrepareSkaffoldFilter(h Client, builds []graph.Artifact, flags []string) (skaffoldBinary string, env []string, cleanup func(), err error) {\n\tskaffoldBinary, err = OSExecutable()\n\tif err != nil {\n\t\treturn \"\", nil, nil, fmt.Errorf(\"cannot locate this Skaffold binary: %w\", err)\n\t}\n\n\tvar buildsFile string\n\tif len(builds) > 0 {\n\t\tbuildsFile, cleanup, err = WriteBuildArtifacts(builds)","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/helm/bin.go#L119-L155","documentation":"PreparePostRenderer installs a helm plugin (postrenderer) via 'helm plugin install' into a temp plugin dir. If that Exec fails, the plugin dir is removed and a PluginErr wrapping 'Failed to install Helm plugin' plus the trimmed helm output is returned. It indicates the helm plugin installation step failed, with helm's own stderr/stdout as the cause detail.","triggerScenarios":"Calling PreparePostRenderer (directly or via deployRelease/generateHelmManifests) when 'helm plugin install <dir>' fails — e.g. plugin dir missing files, incompatible plugin apiVersion, network failure fetching plugin deps, or helm CLI too old.","commonSituations":"Helm version mismatch (plugin apiVersion newer than installed helm); offline/air-gapped environment where plugin dependencies cannot be downloaded; leftover corrupted helmPluginDir from a previous failed attempt; restricted filesystem permissions.","solutions":["Read the wrapped helm output in the error to see helm's own failure reason","Upgrade helm CLI to a version compatible with the plugin's apiVersion","Re-run after clearing any stale plugin state: helm plugin uninstall <name> and remove the plugin directory","Check network/proxy access if the plugin needs to download dependencies"],"exampleFix":"// before\nhelm version  # v3.7 with plugin apiVersion v1 mismatch\n// after\n# upgrade helm\nbrew upgrade helm  # or download helm >= required version\nhelm version\nskaffold deploy  # plugin install now succeeds","handlingStrategy":"try-catch","validationCode":"v := exec.Command(\"helm\", \"version\", \"--short\").Run()\nif v != nil {\n    return errors.New(\"helm CLI not usable; plugin install would fail\")\n}\nif _, err := os.Stat(filepath.Join(helmPluginDir, \"plugin.yaml\")); err != nil {\n    return errors.New(\"helm plugin dir incomplete\")\n}","typeGuard":null,"tryCatchPattern":"_, _, err := h.PreparePostRenderer(ctx, out)\nif err != nil && strings.Contains(err.Error(), \"Failed to install Helm plugin\") {\n    log.Printf(\"helm plugin install failed: %s\", err)\n    // upgrade helm, clean plugin dirs, then retry once\n    exec.Command(\"helm\", \"plugin\", \"uninstall\", \"postrenderer\").Run()\n    err = retryPrepare()\n}","preventionTips":["Keep helm CLI updated to satisfy plugin apiVersion requirements","Ensure network/proxy access for plugin dependency downloads in CI","Clean up stale plugin directories after failed installs"],"tags":["helm","plugin","installation","postrenderer"],"backgroundTag":"plugin-install-failed","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"}