LykosAI/StabilityMatrix · error · ValidationException
Input Image is required
Error message
Input Image is required
What it means
Thrown in SelectImageCardViewModel.ApplyStep when a mask-enabled image-to-image workflow is being built but no source image has been loaded (ImageSource is null). The builder cannot construct the LoadImage/mask node graph without a primary input image, so the validation fails early with a clear message.
Solutions
- Load an input image into the Select Image card before starting the generation
- Re-open the image if a previous load failed (check the image file still exists at its path)
- Disable the mask editor if the workflow is meant to be text-to-image, which does not require an input image
Example fix
// before
await vm.ApplyStep(args); // ImageSource == null -> throws
// after
if (vm.ImageSource is null) { await vm.PromptSelectImageAsync(); }
await vm.ApplyStep(args); Defensive patterns
Strategy: validation
Validate before calling
if (vm.ImageSource is null)
throw new ValidationException("Load an input image before generating (mask mode)"); Type guard
bool hasInputImage = vm.ImageSource is not null;
Try / catch
try { vm.ApplyStep(args); }
catch (ValidationException ex) when (ex.Message == "Input Image is required") { /* show image picker */ } Prevention
- Disable the Generate button until an image is loaded
- Show a preview once ImageSource is set to confirm the load
- Reset mask state when the image is cleared
When it happens
Trigger: ApplyStep with IsMaskEditorEnabled && MaskEditorViewModel.IsMaskEnabled true, and ImageSource == null at the point SetupImagePrimarySourceWithMask is called.
Common situations: User enables the mask editor and paints a mask but never loads a base image; image failed to load from drag-and-drop; the selected image was cleared by a preset reload before ApplyStep ran.
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
- CurrentBitmapSize is null
- API key is required
- Archive must be a zipped tar.
- Definition: ' ' has options, it must have exactly 1 option…
- Definition ' ' has InitialValue of ' ', but it was not…
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/f9e00dc6991a518e.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Avalonia/ViewModels/Inference/SelectImageCardViewModel.cs:161
if (!SyncBitmapSizeToTabContext)
{
return;
}
tabContext.SourceImageWidth = CurrentBitmapSize.Width > 0 ? CurrentBitmapSize.Width : 0;
tabContext.SourceImageHeight = CurrentBitmapSize.Height > 0 ? CurrentBitmapSize.Height : 0;
}
/// <inheritdoc />
public void ApplyStep(ModuleApplyStepEventArgs e)
{
// With Mask image
if (IsMaskEditorEnabled && MaskEditorViewModel.IsMaskEnabled)
{
MaskEditorViewModel.PaintCanvasViewModel.CanvasSize = CurrentBitmapSize;
e.Builder.SetupImagePrimarySourceWithMask(
ImageSource ?? throw new ValidationException("Input Image is required"),
!CurrentBitmapSize.IsEmpty
? CurrentBitmapSize
: throw new ValidationException("CurrentBitmapSize is null"),
MaskEditorViewModel.GetCachedOrNewMaskRenderInverseAlphaImage(),
MaskEditorViewModel.PaintCanvasViewModel.CanvasSize,
e.Builder.Connections.BatchIndex
);
}
// Normal image only
else
{
e.Builder.SetupImagePrimarySource(
ImageSource ?? throw new ValidationException("Input Image is required"),
!CurrentBitmapSize.IsEmpty
? CurrentBitmapSize
: throw new ValidationException("CurrentBitmapSize is null"),
e.Builder.Connections.BatchIndex
);View on GitHub (pinned to af93d6ef57)