{"record":{"id":"774cf9dbc738e791","repo":"derailed/k9s","slug":"s","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/dao/helm_chart.go","lineNumber":140,"sourceCode":"}\n\n// Uninstall uninstalls a HelmChart.\nfunc (h *HelmChart) Uninstall(path string, keepHist bool) error {\n\tns, n := client.Namespaced(path)\n\tflags := h.Client().Config().Flags()\n\tcfg, err := ensureHelmConfig(flags, ns)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu := action.NewUninstall(cfg)\n\tu.KeepHistory = keepHist\n\tres, err := u.Run(n)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif res != nil && res.Info != \"\" {\n\t\treturn fmt.Errorf(\"%s\", res.Info)\n\t}\n\n\treturn nil\n}\n\n// ensureHelmConfig return a new configuration.\nfunc ensureHelmConfig(flags *genericclioptions.ConfigFlags, ns string) (*action.Configuration, error) {\n\tsettings := &genericclioptions.ConfigFlags{\n\t\tNamespace:        &ns,\n\t\tContext:          flags.Context,\n\t\tBearerToken:      flags.BearerToken,\n\t\tAPIServer:        flags.APIServer,\n\t\tCAFile:           flags.CAFile,\n\t\tKubeConfig:       flags.KubeConfig,\n\t\tImpersonate:      flags.Impersonate,\n\t\tInsecure:         flags.Insecure,\n\t\tTLSServerName:    flags.TLSServerName,\n\t\tImpersonateGroup: flags.ImpersonateGroup,","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/dao/helm_chart.go#L122-L158","documentation":"HelmChart.Uninstall (internal/dao/helm_chart.go:124-144) runs the helm uninstall action. If u.Run succeeds (err == nil) but the response carries a non-empty Info string, k9s returns it AS an error via fmt.Errorf(\"%s\", res.Info). Helm fills Info with post-uninstall messages such as kept-hook warnings or notes about resources pending deletion, so a technically successful uninstall can surface here as an error.","triggerScenarios":"Deleting a Helm release from the Helm view where uninstall completes but helm attaches an Info message - e.g. release history kept (u.KeepHistory), hooks not deleted, or resources still terminating. Contrast: a genuinely missing release fails earlier at u.Run with helm's own error, not this one.","commonSituations":"Uninstalling with keep-history enabled; charts with pre/post-delete hooks that helm reports on; CI-shared clusters where another actor already removed the release's resources leaving stray Info.","solutions":["Check the actual state: helm ls --all -n <ns> (or k9s Helm view) - the release is usually already gone","Treat the message text as a warning: kept hooks/history mean cleanup may need --no-hooks or helm delete --keep-history awareness","If history was kept unintentionally, re-run uninstall without keep-history or purge history","Verify no orphaned resources remain: kubectl get all -n <ns> against the chart's manifest"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before uninstalling, confirm the release exists in the namespace.\nfunc ReleaseExists(cfg *action.Configuration, ns, name string) bool {\n\t_, err := cfg.Releases.Last(name)\n\treturn err == nil\n}","typeGuard":null,"tryCatchPattern":"err := h.Uninstall(path, keepHist)\nif err != nil {\n    // res.Info messages follow a successful uninstall: verify state, then downgrade to warning.\n    if _, lsErr := action.NewList(cfg).Run(); lsErr == nil /* release gone */ {\n        slog.Warn(\"helm uninstall info\", slogs.Error, err)\n        return nil // treat as success-with-warning\n    }\n    return err\n}","preventionTips":["Treat helm Info strings as warnings, not failures, when wrapping uninstall in automation","Decide keep-history up front and communicate it, so kept releases do not surprise later uninstalls","Post-uninstall, verify with helm ls --all and kubectl get all instead of trusting the error text"],"tags":["go","helm","kubernetes","k9s","uninstall","release"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}