LykosAI/StabilityMatrix · error · InvalidOperationException
ComfyUI must be installed to use SwarmUI
Error message
ComfyUI must be installed to use SwarmUI
What it means
StableSwarm.InstallPackage throws InvalidOperationException when no installed package named ComfyUI or ComfyUI-Zluda exists, because SwarmUI depends on a ComfyUI backend to function.
Solutions
- Install ComfyUI (or ComfyUI-Zluda) first, then install SwarmUI.
- Reinstall ComfyUI if it was removed; the name must match exactly for the dependency check.
- If using an alternative ComfyUI fork, install the standard ComfyUI package so the dependency resolves.
- Check Settings > Installed Packages to confirm ComfyUI is actually present and not just downloaded.
Defensive patterns
Strategy: validation
Validate before calling
bool hasComfy = settingsManager.Settings.InstalledPackages
.Any(x => x.PackageName is nameof(ComfyUI) or "ComfyUI-Zluda");
if (!hasComfy) { /* install ComfyUI first */ } Try / catch
try { await swarmPackage.InstallPackage(...); }
catch (InvalidOperationException ex) when (ex.Message.Contains("ComfyUI must be installed"))
{ OfferToInstallComfyUiFirst(); } Prevention
- Always install ComfyUI before SwarmUI
- Avoid uninstalling ComfyUI while SwarmUI is present
- Note the dependency check matches exact names ComfyUI / ComfyUI-Zluda
When it happens
Trigger: Installing SwarmUI while the settings' InstalledPackages list contains no package whose PackageName is 'ComfyUI' or 'ComfyUI-Zluda'.
Common situations: User tries to install SwarmUI as their first package; ComfyUI was uninstalled earlier; ComfyUI installed under a different variant name not covered by the check.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- Length cannot be null when latentType is Hunyuan
- Comfy client is not connected
- Flux.2 Klein UNET model not found
- Flux.2 VAE model not found
- Klein 9B requires the qwen_3_8b text encoder, which isn't…
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/5f09168a456db028.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Models/Packages/StableSwarm.cs:227
public override async Task InstallPackage(
string installLocation,
InstalledPackage installedPackage,
InstallPackageOptions options,
IProgress<ProgressReport>? progress = null,
Action<ProcessOutput>? onConsoleOutput = null,
CancellationToken cancellationToken = default
)
{
progress?.Report(new ProgressReport(-1f, "Installing SwarmUI...", isIndeterminate: true));
var comfy = settingsManager.Settings.InstalledPackages.FirstOrDefault(x =>
x.PackageName is nameof(ComfyUI) or "ComfyUI-Zluda"
);
if (comfy == null)
{
throw new InvalidOperationException("ComfyUI must be installed to use SwarmUI");
}
try
{
await prerequisiteHelper
.RunDotnet(
[
"nuget",
"add",
"source",
"https://api.nuget.org/v3/index.json",
"--name",
"\"NuGet official package source\"",
],
workingDirectory: installLocation,
onProcessOutput: onConsoleOutput
)
.ConfigureAwait(false);View on GitHub (pinned to af93d6ef57)