{"record":{"id":"c069e4a837911910","repo":"LykosAI/StabilityMatrix","slug":"torch-version-torchversion-is-not-supported","errorCode":null,"errorMessage":"Torch version {torchVersion} is not supported.","messagePattern":"Torch version (.+?) is not supported\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Core/Models/Packages/Sdfx.cs","lineNumber":206,"sourceCode":"                pythonVersion: options.PythonOptions.PythonVersion\n            )\n            .ConfigureAwait(false);\n        venvRunner.UpdateEnvironmentVariables(GetEnvVars);\n\n        progress?.Report(\n            new ProgressReport(-1f, \"Installing Package Requirements...\", isIndeterminate: true)\n        );\n\n        var torchVersion = options.PythonOptions.TorchIndex ?? GetRecommendedTorchVersion();\n\n        var gpuArg = torchVersion switch\n        {\n            TorchIndex.Cuda => \"--nvidia\",\n            TorchIndex.Rocm => \"--amd\",\n            TorchIndex.DirectMl => \"--directml\",\n            TorchIndex.Cpu => \"--cpu\",\n            TorchIndex.Mps => \"--mac\",\n            _ => throw new NotSupportedException($\"Torch version {torchVersion} is not supported.\"),\n        };\n\n        await venvRunner\n            .CustomInstall([\"setup.py\", \"--install\", gpuArg], onConsoleOutput)\n            .ConfigureAwait(false);\n\n        if (installedPackage.PipOverrides != null)\n        {\n            var pipArgs = new PipInstallArgs().WithUserOverrides(installedPackage.PipOverrides);\n            await venvRunner.PipInstall(pipArgs, onConsoleOutput).ConfigureAwait(false);\n        }\n\n        progress?.Report(new ProgressReport(1, \"Installed Package Requirements\", isIndeterminate: false));\n    }\n\n    public override async Task RunPackage(\n        string installLocation,\n        InstalledPackage installedPackage,","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Core/Models/Packages/Sdfx.cs#L188-L224","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n_ => throw new NotSupportedException($\"Torch version {torchVersion} is not supported.\")\n// after\nTorchIndex.NewIndex => \"--newindex\",\n_ => throw new NotSupportedException($\"Torch version {torchVersion} is not supported.\")","handlingStrategy":"validation","validationCode":"var supported = new[] { TorchIndex.Cuda, TorchIndex.Rocm, TorchIndex.DirectMl, TorchIndex.Cpu, TorchIndex.Mps };\nif (!supported.Contains(torchVersion)) { /* pick a supported torch index before installing */ }","typeGuard":"bool IsSupportedTorchIndex(TorchIndex t) => t is TorchIndex.Cuda or TorchIndex.Rocm or TorchIndex.DirectMl or TorchIndex.Cpu or TorchIndex.Mps;","tryCatchPattern":"try { await package.InstallPackage(...); }\ncatch (NotSupportedException ex) { LetUserPickSupportedGpuIndex(); }","preventionTips":["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"],"tags":["unsupported-enum","torch-index","install"],"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"}