microsoft/aspire · error · InvalidOperationException

Could not parse Helm version from 'helm version --short'…

Error message

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/.

What it means

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.

Solutions

  1. 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.
  2. 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.
  3. Bypass shell wrappers that prepend banners (e.g. login messages, mise/asdf shims misconfigured) by invoking the real binary path.

Example fix

// before (alias pollutes output)
alias helm='echo "Using company helm"; /usr/local/bin/helm' // output unparseable
// after
unalias helm && helm version --short  # v4.2.0
Defensive patterns

Strategy: validation

Validate before calling

// Confirm output matches the expected 'vX.Y.Z...' shape before deploying:
var raw = await CaptureAsync("helm version --short");
if (!System.Text.RegularExpressions.Regex.IsMatch(raw, @"^v\d+\.\d+\.\d+"))
{
    Console.Error.WriteLine($"Unexpected 'helm version --short' output: '{raw}'. Remove aliases/wrappers or reinstall stock Helm.");
}

Try / catch

try
{
    await deployAsync();
}
catch (InvalidOperationException ex) when (ex.Message.StartsWith("Could not parse Helm version"))
{
    // Raw unparsed output is quoted in the message; inspect it for banners/ANSI codes.
    Console.Error.WriteLine(ex.Message);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/fb42f419aeefa564. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.Kubernetes/Deployment/HelmVersionValidator.cs:96

            // is typically a low-level "No such file or directory" or
            // "permission denied" that doesn't tell users what to do, so wrap it.
            throw new InvalidOperationException(
                $"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.",
                ex);
        }

        if (exitCode != 0)
        {
            var errorText = stderr.ToString().Trim();
            var detail = string.IsNullOrEmpty(errorText) ? $"exit code {exitCode}" : errorText;
            throw new InvalidOperationException(
                $"'helm version --short' failed ({detail}). Aspire requires Helm {MinimumHelmVersion} or later. See {InstallDocsUrl}.");
        }

        var rawOutput = stdout.ToString().Trim();
        if (!TryParseHelmVersion(rawOutput, out var detected))
        {
            throw new InvalidOperationException(
                $"Could not parse Helm version from 'helm version --short' output: '{rawOutput}'. Aspire requires Helm {MinimumHelmVersion} or later. See {InstallDocsUrl}.");
        }

        if (detected < MinimumHelmVersion)
        {
            throw new InvalidOperationException(
                string.Format(
                    CultureInfo.InvariantCulture,
                    "Helm {0} was detected, but Aspire requires Helm {1} or later to deploy Kubernetes resources. Upgrade Helm from {2}.",
                    detected,
                    MinimumHelmVersion,
                    InstallDocsUrl));
        }
    }

    /// <summary>
    /// Extracts the first <c>MAJOR.MINOR.PATCH</c> token from the given Helm version
    /// output. Returns <see langword="false"/> if no version token is present.

View on GitHub (pinned to 25830f84bd)