LykosAI/StabilityMatrix · warning · ValidationException

No ImageSource

Error message

No ImageSource

What it means

PreviewPreprocessor in ControlNetCardViewModel builds a ComfyUI node graph for ControlNet preprocessing. It resolves the input image via SelectImageCardViewModel.ImageSource?.GetHashGuidFileNameCached("Inference") and throws ValidationException("No ImageSource") when the image card has no image selected, since the preprocessor pipeline cannot run without an input image.

Solutions

  1. Add or select an input image on the ControlNet card before running the preprocessor preview
  2. Disable the preview button in the UI while ImageSource is null
  3. Catch ValidationException around preview invocation and show 'select an input image first' to the user

Example fix

// before
Image = SelectImageCardViewModel.ImageSource?.GetHashGuidFileNameCached("Inference")
    ?? throw new ValidationException("No ImageSource")

// after (guard at call site)
if (SelectImageCardViewModel.ImageSource is null)
{
    Logger.Warn("PreviewPreprocessor skipped: no image selected");
    return;
}
var image = args.Nodes.AddTypedNode(new ComfyNodeBuilder.LoadImage { ... });
Defensive patterns

Strategy: validation

Validate before calling

// Before invoking the preprocessor preview
if (controlNetCardVm.SelectImageCardViewModel.ImageSource is null)
{
    Logger.Warn("Cannot preview preprocessor: no image selected");
    return;
}

Type guard

bool HasControlNetImage(ControlNetCardViewModel card) =>
    card.SelectImageCardViewModel?.ImageSource is not null;

Try / catch

try
{
    await controlNetCardVm.PreviewPreprocessor();
}
catch (ValidationException ex) when (ex.Message == "No ImageSource")
{
    NotificationHelper.Warn("Select an input image on the ControlNet card first");
}

Prevention

When it happens

Trigger: Clicking the ControlNet preview/preprocess button while the ControlNet card's SelectImageCardViewModel has ImageSource == null (no image dropped, selected, or loaded yet).

Common situations: Hitting preview before adding an input image to the ControlNet card; image failed to load earlier (bad file, cancelled import) leaving ImageSource unset; UI state reset after workflow changes.

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


AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12). Data as JSON: /api/errors/051af6ab475d4527. Report an issue: GitHub.

Appendix: source

Thrown at StabilityMatrix.Avalonia/ViewModels/Inference/ControlNetCardViewModel.cs:114

            preprocessor is null
            || SelectImageCardViewModel.ImageSource is not { } imageSource
            || SelectImageCardViewModel.IsImageFileNotFound
        )
            return;

        var args = new InferenceQueueCustomPromptEventArgs();

        var images = SelectImageCardViewModel.GetInputImages();

        await ClientManager.UploadInputImageAsync(imageSource);

        var image = args.Nodes.AddTypedNode(
            new ComfyNodeBuilder.LoadImage
            {
                Name = args.Nodes.GetUniqueName("Preprocessor_LoadImage"),
                Image =
                    SelectImageCardViewModel.ImageSource?.GetHashGuidFileNameCached("Inference")
                    ?? throw new ValidationException("No ImageSource")
            }
        ).Output1;

        var aioPreprocessor = args.Nodes.AddTypedNode(
            new ComfyNodeBuilder.AIOPreprocessor
            {
                Name = args.Nodes.GetUniqueName("Preprocessor"),
                Image = image,
                Preprocessor = preprocessor.ToString(),
                // AIO wants the lower of the two resolutions. who knows why.
                // also why can't we put in the low/high thresholds?
                // Or any of the other parameters for the other preprocessors?
                Resolution = Math.Min(Width, Height)
            }
        );

        args.Builder.Connections.OutputNodes.Add(
            args.Nodes.AddTypedNode(

View on GitHub (pinned to af93d6ef57)