microsoft/aspire · error · InvalidOperationException

Aspire skills bundle contains an invalid version comparator

Error message

Aspire skills bundle contains an invalid version comparator '{0}'.

What it means

ParseComparator recognizes a known operator prefix and then requires a non-empty operand. A comparator like ">=", "<", or "=" with nothing after the operator throws this formatted InvalidOperationException, since a comparison needs a version operand.

Solutions

  1. Add the missing version operand after the operator, e.g. '>=9.0.0'
  2. Validate the range string in the bundle manifest before publishing
  3. Republish the bundle with the corrected range

Example fix

// before
"supports": { "aspireCli": ">= <10.0.0" }
// after
"supports": { "aspireCli": ">=9.0.0 <10.0.0" }
Defensive patterns

Strategy: validation

Validate before calling

foreach (var token in range.Split(' ', ','))
    if (token is ">=" or "<=" or "==" or ">" or "<" or "=")
        throw new InvalidOperationException($"Comparator '{token}' has no version operand.");

Try / catch

try
{
    await installer.InstallAsync(bundleRef);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("invalid version comparator"))
{
    logger.LogError(ex, "A range operator is missing its version operand; fix the manifest range.");
}

Prevention

When it happens

Trigger: Range strings containing dangling operators, e.g. ">= <10.0.0", ">=,", or a trailing ">=", parsed inside IsVersionInRange from the manifest's supports ranges.

Common situations: Hand-edited manifests with a missing version after an operator, string manipulation that dropped the operand, or accidental double spaces combined with trimming producing bare operators.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at src/Aspire.Cli/Agents/AspireSkills/AspireSkillsBundleProvider.cs:709

            ">" => comparison > 0,
            ">=" => comparison >= 0,
            "<" => comparison < 0,
            "<=" => comparison <= 0,
            "=" or "==" => comparison == 0,
            _ => throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Unsupported Aspire skills bundle version comparator '{0}'.", op))
        };
    }

    private static (string Operator, string Operand) ParseComparator(string comparator)
    {
        foreach (var op in new[] { ">=", "<=", "==", ">", "<", "=" })
        {
            if (comparator.StartsWith(op, StringComparison.Ordinal))
            {
                var operand = comparator[op.Length..];
                if (string.IsNullOrWhiteSpace(operand))
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Aspire skills bundle contains an invalid version comparator '{0}'.", comparator));
                }

                return (op, operand);
            }
        }

        return ("=", comparator);
    }

    private static SemVersion ParseCompatibilityVersion(string version)
    {
        if (!SemVersion.TryParse(version, SemVersionStyles.Any, out var parsedVersion))
        {
            throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Aspire skills bundle contains an invalid version value '{0}'.", version));
        }

        return SemVersion.Parse(
            string.Create(

View on GitHub (pinned to 25830f84bd)