{"record":{"id":"f9e00dc6991a518e","repo":"LykosAI/StabilityMatrix","slug":"input-image-is-required","errorCode":null,"errorMessage":"Input Image is required","messagePattern":"Input Image is required","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Inference/SelectImageCardViewModel.cs","lineNumber":161,"sourceCode":"        if (!SyncBitmapSizeToTabContext)\n        {\n            return;\n        }\n\n        tabContext.SourceImageWidth = CurrentBitmapSize.Width > 0 ? CurrentBitmapSize.Width : 0;\n        tabContext.SourceImageHeight = CurrentBitmapSize.Height > 0 ? CurrentBitmapSize.Height : 0;\n    }\n\n    /// <inheritdoc />\n    public void ApplyStep(ModuleApplyStepEventArgs e)\n    {\n        // With Mask image\n        if (IsMaskEditorEnabled && MaskEditorViewModel.IsMaskEnabled)\n        {\n            MaskEditorViewModel.PaintCanvasViewModel.CanvasSize = CurrentBitmapSize;\n\n            e.Builder.SetupImagePrimarySourceWithMask(\n                ImageSource ?? throw new ValidationException(\"Input Image is required\"),\n                !CurrentBitmapSize.IsEmpty\n                    ? CurrentBitmapSize\n                    : throw new ValidationException(\"CurrentBitmapSize is null\"),\n                MaskEditorViewModel.GetCachedOrNewMaskRenderInverseAlphaImage(),\n                MaskEditorViewModel.PaintCanvasViewModel.CanvasSize,\n                e.Builder.Connections.BatchIndex\n            );\n        }\n        // Normal image only\n        else\n        {\n            e.Builder.SetupImagePrimarySource(\n                ImageSource ?? throw new ValidationException(\"Input Image is required\"),\n                !CurrentBitmapSize.IsEmpty\n                    ? CurrentBitmapSize\n                    : throw new ValidationException(\"CurrentBitmapSize is null\"),\n                e.Builder.Connections.BatchIndex\n            );","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Inference/SelectImageCardViewModel.cs#L143-L179","documentation":"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.","triggerScenarios":"ApplyStep with IsMaskEditorEnabled && MaskEditorViewModel.IsMaskEnabled true, and ImageSource == null at the point SetupImagePrimarySourceWithMask is called.","commonSituations":"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.","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"],"exampleFix":"// before\nawait vm.ApplyStep(args); // ImageSource == null -> throws\n// after\nif (vm.ImageSource is null) { await vm.PromptSelectImageAsync(); }\nawait vm.ApplyStep(args);","handlingStrategy":"validation","validationCode":"if (vm.ImageSource is null)\n    throw new ValidationException(\"Load an input image before generating (mask mode)\");","typeGuard":"bool hasInputImage = vm.ImageSource is not null;","tryCatchPattern":"try { vm.ApplyStep(args); }\ncatch (ValidationException ex) when (ex.Message == \"Input Image is required\") { /* show image picker */ }","preventionTips":["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"],"tags":["validation","image-input","img2img"],"backgroundTag":"missing-required-argument","analyzedSha":"af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002","analyzedAt":"2026-09-12T19:02:43.389Z","contentChangedAt":"2026-09-12T19:02:43.389Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}