LykosAI/StabilityMatrix · error · NotSupportedException
Torch version is not supported.
Error message
Torch version {torchVersion} is not supported. What it means
Sdfx.InstallPackage builds a GPU flag via a switch on torchVersion and throws NotSupportedException for any TorchIndex value not explicitly mapped (Cuda, Rocm, DirectMl, Cpu, Mps). This indicates an unrecognized or future torch index enum value.
Solutions
- Update Stability Matrix so Sdfx's install code supports the torch index you selected.
- Choose a supported torch index for the package (CUDA, ROCm, DirectML, CPU, or MPS).
- Reset the package's torch/GPU index setting in the package options and reinstall.
- If developing, add the missing TorchIndex case to the switch in Sdfx.cs.
Example fix
// before
_ => throw new NotSupportedException($"Torch version {torchVersion} is not supported.")
// after
TorchIndex.NewIndex => "--newindex",
_ => throw new NotSupportedException($"Torch version {torchVersion} is not supported.") Defensive patterns
Strategy: validation
Validate before calling
var supported = new[] { TorchIndex.Cuda, TorchIndex.Rocm, TorchIndex.DirectMl, TorchIndex.Cpu, TorchIndex.Mps };
if (!supported.Contains(torchVersion)) { /* pick a supported torch index before installing */ } Type guard
bool IsSupportedTorchIndex(TorchIndex t) => t is TorchIndex.Cuda or TorchIndex.Rocm or TorchIndex.DirectMl or TorchIndex.Cpu or TorchIndex.Mps;
Try / catch
try { await package.InstallPackage(...); }
catch (NotSupportedException ex) { LetUserPickSupportedGpuIndex(); } Prevention
- Select a GPU/torch index from the supported list before installing SDFX
- Update the app when new torch indexes are introduced
- Reset GPU index settings after upgrading between versions
When it happens
Trigger: InstallPackage with a torchVersion that is not one of the five mapped TorchIndex members — e.g. a newly added enum value or a default/uninitialized one.
Common situations: Newer Stability Matrix version introduced a TorchIndex variant that Sdfx's installer doesn't handle yet; corrupted settings producing an out-of-range torch index.
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/c069e4a837911910.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Models/Packages/Sdfx.cs:206
pythonVersion: options.PythonOptions.PythonVersion
)
.ConfigureAwait(false);
venvRunner.UpdateEnvironmentVariables(GetEnvVars);
progress?.Report(
new ProgressReport(-1f, "Installing Package Requirements...", isIndeterminate: true)
);
var torchVersion = options.PythonOptions.TorchIndex ?? GetRecommendedTorchVersion();
var gpuArg = torchVersion switch
{
TorchIndex.Cuda => "--nvidia",
TorchIndex.Rocm => "--amd",
TorchIndex.DirectMl => "--directml",
TorchIndex.Cpu => "--cpu",
TorchIndex.Mps => "--mac",
_ => throw new NotSupportedException($"Torch version {torchVersion} is not supported."),
};
await venvRunner
.CustomInstall(["setup.py", "--install", gpuArg], onConsoleOutput)
.ConfigureAwait(false);
if (installedPackage.PipOverrides != null)
{
var pipArgs = new PipInstallArgs().WithUserOverrides(installedPackage.PipOverrides);
await venvRunner.PipInstall(pipArgs, onConsoleOutput).ConfigureAwait(false);
}
progress?.Report(new ProgressReport(1, "Installed Package Requirements", isIndeterminate: false));
}
public override async Task RunPackage(
string installLocation,
InstalledPackage installedPackage,View on GitHub (pinned to af93d6ef57)