{"record":{"id":"d98ae1f66f911ff9","repo":"LykosAI/StabilityMatrix","slug":"unsupported-windows-rocm-package-command-type-commandtype","errorCode":null,"errorMessage":"Unsupported Windows ROCm package command type: {CommandType}.","messagePattern":"Unsupported Windows ROCm package command type: (.+?)\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Models/PackageModification/InstallWindowsRocmPackageCommandStep.cs","lineNumber":113,"sourceCode":"            environmentVariables: EnvironmentVariables\n        );\n\n        switch (CommandType)\n        {\n            case WindowsRocmPackageCommandType.SageAttention:\n                await ExecuteSageAttentionAsync(venvRunner, progress).ConfigureAwait(false);\n                break;\n            case WindowsRocmPackageCommandType.DevelopmentSdk:\n                await ExecuteDevelopmentSdkAsync(venvRunner, progress).ConfigureAwait(false);\n                break;\n            case WindowsRocmPackageCommandType.BitsAndBytes:\n                await ExecuteBitsAndBytesAsync(venvRunner, pyVersion, progress).ConfigureAwait(false);\n                break;\n            case WindowsRocmPackageCommandType.FlashAttention:\n                await ExecuteFlashAttentionAsync(venvRunner, progress).ConfigureAwait(false);\n                break;\n            default:\n                throw new InvalidOperationException(\n                    $\"Unsupported Windows ROCm package command type: {CommandType}.\"\n                );\n        }\n    }\n\n    private void EnsureRocmCompatibility()\n    {\n        var compatibility = rocmPackageHelper.GetCompatibility();\n        if (!compatibility.IsCompatible)\n        {\n            throw new InvalidOperationException(\n                compatibility.FailureReason\n                    ?? \"Windows ROCm package commands require a supported Windows ROCm machine state.\"\n            );\n        }\n    }\n\n    private async Task EnsureVcBuildToolsAsync(IProgress<ProgressReport>? progress)","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Models/PackageModification/InstallWindowsRocmPackageCommandStep.cs#L95-L131","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use only defined WindowsRocmPackageCommandType values when constructing the step; validate Enum.IsDefined before executing.","Fix or regenerate the config/workflow file that contains the unknown command type.","If you added a new enum member, add a corresponding case (and Execute* method) to the switch in ExecuteAsync.","Upgrade/downgrade the app so the step and config enum versions match."],"exampleFix":"// before\nvar type = (WindowsRocmPackageCommandType)config.CommandTypeInt;\n// after\nvar type = (WindowsRocmPackageCommandType)config.CommandTypeInt;\nif (!Enum.IsDefined(type))\n    throw new InvalidOperationException($\"Unknown ROCm command type {config.CommandTypeInt}\");","handlingStrategy":"validation","validationCode":"if (!Enum.IsDefined(typeof(WindowsRocmPackageCommandType), commandType))\n    throw new ArgumentOutOfRangeException(nameof(commandType), $\"Unknown ROCm command type: {commandType}\");","typeGuard":"bool IsKnownRocmCommandType(WindowsRocmPackageCommandType t) =>\n    t is WindowsRocmPackageCommandType.SageAttention\n        or WindowsRocmPackageCommandType.DevelopmentSdk\n        or WindowsRocmPackageCommandType.BitsAndBytes\n        or WindowsRocmPackageCommandType.FlashAttention;","tryCatchPattern":"try\n{\n    await step.ExecuteAsync(progress);\n}\ncatch (InvalidOperationException ex) when (ex.Message.StartsWith(\"Unsupported Windows ROCm package command type\"))\n{\n    // fix CommandType value or app/config version mismatch\n}","preventionTips":["Never cast arbitrary ints into WindowsRocmPackageCommandType without Enum.IsDefined.","Keep enum values stable across app versions, or validate stored configs on load.","When adding enum members, update the switch in ExecuteAsync in the same change."],"tags":["invalid-enum-value","switch","rocm","configuration"],"backgroundTag":"invalid-enum-value","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}