LykosAI/StabilityMatrix · error · ValidationException
No ImageSource
Error message
No ImageSource
What it means
ControlNetModule.OnApplyStep throws this ValidationException while adding a ComfyNodeBuilder.LoadImage node: the ControlNet card's SelectImageCardViewModel.ImageSource is null, so there is no image hash file to pass to the ControlNet load-image node. A ControlNet unit fundamentally needs an input image, so the builder aborts workflow generation.
Solutions
- Select or import an image in the ControlNet card's image area before generating.
- Programmatically set card.SelectImageCardViewModel.ImageSource to a valid ImageSource before running.
- Disable or remove the ControlNet module if it is not needed for this generation.
- Re-add the missing image file so its hash-backed filename can be resolved in the 'Inference' images directory.
Example fix
// before
controlNetCard.SelectedModel = cnModel; // no image set
await vm.Generate();
// after
controlNetCard.SelectedModel = cnModel;
controlNetCard.SelectImageCardViewModel.ImageSource = await imageFile.SaveToImageInferenceManagement("Inference");
await vm.Generate(); Defensive patterns
Strategy: validation
Validate before calling
if (controlNetCard.SelectImageCardViewModel.ImageSource is null)
throw new InvalidOperationException("ControlNet requires an input image"); Type guard
var hasImage = controlNetCard.SelectImageCardViewModel.ImageSource is not null;
Try / catch
try { await vm.Generate(); }
catch (ValidationException ex) when (ex.Message == "No ImageSource")
{
// prompt user to add a ControlNet input image
} Prevention
- Only enable the ControlNet module once an image is present in the image card.
- After selecting an image, confirm the hash file exists in the Inference images directory.
- When toggling ControlNet on, immediately focus the image selector.
When it happens
Trigger: Enabling/including a ControlNet module in the inference pipeline without selecting an image in the ControlNet card's image selector before generation.
Common situations: User adds a ControlNet card, picks a model and preprocessor, but forgets to drop/select the reference image; imported workflow JSON references an image missing from the Inference images directory so ImageSource resolves to null; image was deleted after being selected.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- No ImageSource
- No SelectedModel
- Length cannot be null when latentType is Hunyuan
- Prompt extensions not installed
- Model not selected
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/f79288e751c37cdc.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Avalonia/ViewModels/Inference/Modules/ControlNetModule.cs:52
is { ImageSource: { } image, IsImageFileNotFound: false }
)
{
yield return image;
}
}
/// <inheritdoc />
protected override void OnApplyStep(ModuleApplyStepEventArgs e)
{
var card = GetCard<ControlNetCardViewModel>();
var image = e.Nodes.AddTypedNode(
new ComfyNodeBuilder.LoadImage
{
Name = e.Nodes.GetUniqueName("ControlNet_LoadImage"),
Image =
card.SelectImageCardViewModel.ImageSource?.GetHashGuidFileNameCached("Inference")
?? throw new ValidationException("No ImageSource")
}
).Output1;
if (card.SelectedPreprocessor is { } preprocessor && preprocessor != ComfyAuxPreprocessor.None)
{
var aioPreprocessor = e.Nodes.AddTypedNode(
new ComfyNodeBuilder.AIOPreprocessor
{
Name = e.Nodes.GetUniqueName("ControlNet_Preprocessor"),
Image = image,
Preprocessor = preprocessor.ToString(),
// Use lower of width and height for resolution
Resolution = Math.Min(card.Width, card.Height)
}
);
image = aioPreprocessor.Output;
}View on GitHub (pinned to af93d6ef57)