{"record":{"id":"ec91005ed7636f0a","repo":"microsoft/aspire","slug":"helm-upgrade-install-for-chart-chart-name-failed-with-exit","errorCode":null,"errorMessage":"helm upgrade --install for chart '{chart.Name}' failed with exit code {exitCode}","messagePattern":"helm upgrade --install for chart '(.+?)' failed with exit code (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Kubernetes/KubernetesHelmChartExtensions.cs","lineNumber":362,"sourceCode":"\n        var exitCode = await helmRunner.RunAsync(\n            arguments.ToString(),\n            onOutputData: output => logger.LogDebug(\"helm (stdout): {Output}\", output),\n            onErrorData: error =>\n            {\n                stderrBuilder.AppendLine(error);\n                logger.LogDebug(\"helm (stderr): {Error}\", error);\n            },\n            cancellationToken: context.CancellationToken).ConfigureAwait(false);\n\n        if (exitCode != 0)\n        {\n            var errorOutput = stderrBuilder.ToString().Trim();\n            var message = string.IsNullOrEmpty(errorOutput)\n                ? $\"helm upgrade --install for chart '{chart.Name}' failed with exit code {exitCode}\"\n                : $\"helm upgrade --install for chart '{chart.Name}' failed: {errorOutput}\";\n\n            throw new InvalidOperationException(message);\n        }\n\n        if (chart.DestroyOnUninstall)\n        {\n            // Persist install state so destroy can find this release later, even from a\n            // different process where the in-memory resource state is gone.\n            var deploymentStateManager = context.Services.GetRequiredService<IDeploymentStateManager>();\n            var stateSection = await deploymentStateManager\n                .AcquireSectionAsync(GetStateSectionName(environment, chart), context.CancellationToken)\n                .ConfigureAwait(false);\n            stateSection.Data[\"ReleaseName\"] = releaseName;\n            stateSection.Data[\"Namespace\"] = @namespace;\n            await deploymentStateManager.SaveSectionAsync(stateSection, context.CancellationToken).ConfigureAwait(false);\n        }\n\n        logger.LogInformation(\n            \"Helm chart '{ChartName}' installed successfully as release '{ReleaseName}' in namespace '{Namespace}'.\",\n            chart.Name, releaseName, @namespace);","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Kubernetes/KubernetesHelmChartExtensions.cs#L344-L380","documentation":"InstallHelmChartAsync runs 'helm upgrade --install' for the chart and throws InvalidOperationException when the helm process exits with a non-zero exit code. If helm captured stderr, that error output is included in the message; otherwise only the exit code is reported.","triggerScenarios":"helm upgrade --install returns non-zero: invalid chart or values, unreachable cluster, missing kubeconfig context, existing release with a conflicting revision, insufficient RBAC, or helm not finding resources it expects.","commonSituations":"Cluster unreachable/wrong context; chart values failing schema validation; a previous failed release in a broken state; namespace missing or RBAC denied; image pull failures surfacing through helm hooks.","solutions":["Read the included helm stderr output in the exception message for the root cause","Run the same 'helm upgrade --install' command manually against the cluster to see full diagnostics","Verify kubeconfig/context and cluster connectivity (kubectl cluster-info)","Fix chart values or templates that helm rejects","Delete/reset a broken prior helm release before reinstalling"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-checks before install\nif (string.IsNullOrWhiteSpace(chart.Path) || !File.Exists(chart.Path))\n    throw new FileNotFoundException(\"Helm chart not found.\", chart.Path);\nvar psi = new ProcessStartInfo(\"helm\", \"version --short\"); // verify helm + cluster reachability\n","typeGuard":null,"tryCatchPattern":"try { await InstallHelmChartAsync(chart, ...); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"helm upgrade --install\"))\n{ logger.LogError(ex, \"Helm install failed: {Detail}\", ex.Message); }","preventionTips":["Validate chart path and values before install","Confirm cluster connectivity and kubeconfig context first","Run 'helm lint' on the chart to catch template errors early","Clean up broken prior releases before retrying"],"tags":["kubernetes","helm","deploy","process"],"backgroundTag":"command-not-found","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T09:17:21.228Z"}