LykosAI/StabilityMatrix · error · InvalidOperationException

Unsupported Windows ROCm package command type

Error message

Unsupported Windows ROCm package command type: {CommandType}.

What it means

ExecuteAsync switches on the step's CommandType (WindowsRocmPackageCommandType). If the value falls outside the four known cases (SageAttention, DevelopmentSdk, BitsAndBytes, FlashAttention) it throws this InvalidOperationException. Since the enum has exactly those members, this only fires for out-of-range/cast values or a new enum member added without a case.

Solutions

  1. Use only defined WindowsRocmPackageCommandType values when constructing the step; validate Enum.IsDefined before executing.
  2. Fix or regenerate the config/workflow file that contains the unknown command type.
  3. If you added a new enum member, add a corresponding case (and Execute* method) to the switch in ExecuteAsync.
  4. Upgrade/downgrade the app so the step and config enum versions match.

Example fix

// before
var type = (WindowsRocmPackageCommandType)config.CommandTypeInt;
// after
var type = (WindowsRocmPackageCommandType)config.CommandTypeInt;
if (!Enum.IsDefined(type))
    throw new InvalidOperationException($"Unknown ROCm command type {config.CommandTypeInt}");
Defensive patterns

Strategy: validation

Validate before calling

if (!Enum.IsDefined(typeof(WindowsRocmPackageCommandType), commandType))
    throw new ArgumentOutOfRangeException(nameof(commandType), $"Unknown ROCm command type: {commandType}");

Type guard

bool IsKnownRocmCommandType(WindowsRocmPackageCommandType t) =>
    t is WindowsRocmPackageCommandType.SageAttention
        or WindowsRocmPackageCommandType.DevelopmentSdk
        or WindowsRocmPackageCommandType.BitsAndBytes
        or WindowsRocmPackageCommandType.FlashAttention;

Try / catch

try
{
    await step.ExecuteAsync(progress);
}
catch (InvalidOperationException ex) when (ex.Message.StartsWith("Unsupported Windows ROCm package command type"))
{
    // fix CommandType value or app/config version mismatch
}

Prevention

When it happens

Trigger: Setting CommandType to an undefined enum value via an unchecked cast ((WindowsRocmPackageCommandType)99), deserializing an unknown value from config/JSON, or adding a new enum member without updating the switch.

Common situations: Loading a saved one-click installer config written by a newer app version whose enum has extra members; programmatic misuse casting ints into the enum; a developer adding a new ROCm command type but forgetting the switch arm.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12). Data as JSON: /api/errors/d98ae1f66f911ff9. Report an issue: GitHub.

Appendix: source

Thrown at StabilityMatrix.Core/Models/PackageModification/InstallWindowsRocmPackageCommandStep.cs:113

            environmentVariables: EnvironmentVariables
        );

        switch (CommandType)
        {
            case WindowsRocmPackageCommandType.SageAttention:
                await ExecuteSageAttentionAsync(venvRunner, progress).ConfigureAwait(false);
                break;
            case WindowsRocmPackageCommandType.DevelopmentSdk:
                await ExecuteDevelopmentSdkAsync(venvRunner, progress).ConfigureAwait(false);
                break;
            case WindowsRocmPackageCommandType.BitsAndBytes:
                await ExecuteBitsAndBytesAsync(venvRunner, pyVersion, progress).ConfigureAwait(false);
                break;
            case WindowsRocmPackageCommandType.FlashAttention:
                await ExecuteFlashAttentionAsync(venvRunner, progress).ConfigureAwait(false);
                break;
            default:
                throw new InvalidOperationException(
                    $"Unsupported Windows ROCm package command type: {CommandType}."
                );
        }
    }

    private void EnsureRocmCompatibility()
    {
        var compatibility = rocmPackageHelper.GetCompatibility();
        if (!compatibility.IsCompatible)
        {
            throw new InvalidOperationException(
                compatibility.FailureReason
                    ?? "Windows ROCm package commands require a supported Windows ROCm machine state."
            );
        }
    }

    private async Task EnsureVcBuildToolsAsync(IProgress<ProgressReport>? progress)

View on GitHub (pinned to af93d6ef57)