{"record":{"id":"fb42f419aeefa564","repo":"microsoft/aspire","slug":"could-not-parse-helm-version-from-helm-version-short-output","errorCode":null,"errorMessage":"Could not parse Helm version from 'helm version --short' output: '{rawOutput}'. Aspire requires Helm 4.2.0 or later. See https://helm.sh/docs/intro/install/.","messagePattern":"Could not parse Helm version from 'helm version --short' output: '(.+?)'\\. Aspire requires Helm 4\\.2\\.0 or later\\. See https://helm\\.sh/docs/intro/install/\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Kubernetes/Deployment/HelmVersionValidator.cs","lineNumber":96,"sourceCode":"            // is typically a low-level \"No such file or directory\" or\n            // \"permission denied\" that doesn't tell users what to do, so wrap it.\n            throw new InvalidOperationException(\n                $\"Helm CLI not found or could not be invoked. Aspire requires Helm {MinimumHelmVersion} or later. Install it from {InstallDocsUrl} and ensure it is available on your PATH.\",\n                ex);\n        }\n\n        if (exitCode != 0)\n        {\n            var errorText = stderr.ToString().Trim();\n            var detail = string.IsNullOrEmpty(errorText) ? $\"exit code {exitCode}\" : errorText;\n            throw new InvalidOperationException(\n                $\"'helm version --short' failed ({detail}). Aspire requires Helm {MinimumHelmVersion} or later. See {InstallDocsUrl}.\");\n        }\n\n        var rawOutput = stdout.ToString().Trim();\n        if (!TryParseHelmVersion(rawOutput, out var detected))\n        {\n            throw new InvalidOperationException(\n                $\"Could not parse Helm version from 'helm version --short' output: '{rawOutput}'. Aspire requires Helm {MinimumHelmVersion} or later. See {InstallDocsUrl}.\");\n        }\n\n        if (detected < MinimumHelmVersion)\n        {\n            throw new InvalidOperationException(\n                string.Format(\n                    CultureInfo.InvariantCulture,\n                    \"Helm {0} was detected, but Aspire requires Helm {1} or later to deploy Kubernetes resources. Upgrade Helm from {2}.\",\n                    detected,\n                    MinimumHelmVersion,\n                    InstallDocsUrl));\n        }\n    }\n\n    /// <summary>\n    /// Extracts the first <c>MAJOR.MINOR.PATCH</c> token from the given Helm version\n    /// output. Returns <see langword=\"false\"/> if no version token is present.","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Kubernetes/Deployment/HelmVersionValidator.cs#L78-L114","documentation":"Thrown when 'helm version --short' succeeds (exit code 0) but its output cannot be parsed into a semantic version by TryParseHelmVersion. The raw unparsed output is included in the message. Aspire cannot verify the minimum required version (4.2.0) without parsing it, so it fails fast with guidance.","triggerScenarios":"EnsureMinimumVersionAsync reads trimmed stdout of 'helm version --short' and fails when TryParseHelmVersion cannot extract a version - e.g. unexpected output formats, warning text or ANSI color codes mixed into stdout, non-English locale output, or forked/distro helm builds printing non-standard version strings.","commonSituations":"Shell alias or wrapper script injecting extra text before/after the version line; terminal color codes polluting captured output; exotic helm distributions (e.g. some cloud-vendored builds) changing the version string format; locale-specific output from patched builds.","solutions":["Run 'helm version --short' directly; its output appears in the exception, so check for extra text/ANSI codes around the version token and remove the wrapper/alias causing it.","Install a standard Helm 4.2.0+ build from https://helm.sh/docs/intro/install/ whose 'version --short' emits the expected 'vX.Y.Z+sha' format.","Bypass shell wrappers that prepend banners (e.g. login messages, mise/asdf shims misconfigured) by invoking the real binary path."],"exampleFix":"// before (alias pollutes output)\nalias helm='echo \"Using company helm\"; /usr/local/bin/helm' // output unparseable\n// after\nunalias helm && helm version --short  # v4.2.0","handlingStrategy":"validation","validationCode":"// Confirm output matches the expected 'vX.Y.Z...' shape before deploying:\nvar raw = await CaptureAsync(\"helm version --short\");\nif (!System.Text.RegularExpressions.Regex.IsMatch(raw, @\"^v\\d+\\.\\d+\\.\\d+\"))\n{\n    Console.Error.WriteLine($\"Unexpected 'helm version --short' output: '{raw}'. Remove aliases/wrappers or reinstall stock Helm.\");\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    await deployAsync();\n}\ncatch (InvalidOperationException ex) when (ex.Message.StartsWith(\"Could not parse Helm version\"))\n{\n    // Raw unparsed output is quoted in the message; inspect it for banners/ANSI codes.\n    Console.Error.WriteLine(ex.Message);\n}","preventionTips":["Do not alias or wrap 'helm' with scripts that print extra text to stdout.","Disable ANSI color injection in captured output (non-interactive shells usually avoid this).","Use a stock Helm distribution rather than heavily patched vendor forks.","Check the quoted output in the exception to spot shim/wrapper interference (asdf, mise, company login banners)."],"tags":["helm","version-check","cli","parsing","kubernetes"],"backgroundTag":"unexpected-response-shape","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}