{"record":{"id":"f79288e751c37cdc","repo":"LykosAI/StabilityMatrix","slug":"no-imagesource-controlnetmodule","errorCode":null,"errorMessage":"No ImageSource","messagePattern":"No ImageSource","errorType":"validation","errorClass":"ValidationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Inference/Modules/ControlNetModule.cs","lineNumber":52,"sourceCode":"                is { ImageSource: { } image, IsImageFileNotFound: false }\n        )\n        {\n            yield return image;\n        }\n    }\n\n    /// <inheritdoc />\n    protected override void OnApplyStep(ModuleApplyStepEventArgs e)\n    {\n        var card = GetCard<ControlNetCardViewModel>();\n\n        var image = e.Nodes.AddTypedNode(\n            new ComfyNodeBuilder.LoadImage\n            {\n                Name = e.Nodes.GetUniqueName(\"ControlNet_LoadImage\"),\n                Image =\n                    card.SelectImageCardViewModel.ImageSource?.GetHashGuidFileNameCached(\"Inference\")\n                    ?? throw new ValidationException(\"No ImageSource\")\n            }\n        ).Output1;\n\n        if (card.SelectedPreprocessor is { } preprocessor && preprocessor != ComfyAuxPreprocessor.None)\n        {\n            var aioPreprocessor = e.Nodes.AddTypedNode(\n                new ComfyNodeBuilder.AIOPreprocessor\n                {\n                    Name = e.Nodes.GetUniqueName(\"ControlNet_Preprocessor\"),\n                    Image = image,\n                    Preprocessor = preprocessor.ToString(),\n                    // Use lower of width and height for resolution\n                    Resolution = Math.Min(card.Width, card.Height)\n                }\n            );\n\n            image = aioPreprocessor.Output;\n        }","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Inference/Modules/ControlNetModule.cs#L34-L70","documentation":"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.","triggerScenarios":"Enabling/including a ControlNet module in the inference pipeline without selecting an image in the ControlNet card's image selector before generation.","commonSituations":"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.","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."],"exampleFix":"// before\ncontrolNetCard.SelectedModel = cnModel; // no image set\nawait vm.Generate();\n// after\ncontrolNetCard.SelectedModel = cnModel;\ncontrolNetCard.SelectImageCardViewModel.ImageSource = await imageFile.SaveToImageInferenceManagement(\"Inference\");\nawait vm.Generate();","handlingStrategy":"validation","validationCode":"if (controlNetCard.SelectImageCardViewModel.ImageSource is null)\n    throw new InvalidOperationException(\"ControlNet requires an input image\");","typeGuard":"var hasImage = controlNetCard.SelectImageCardViewModel.ImageSource is not null;","tryCatchPattern":"try { await vm.Generate(); }\ncatch (ValidationException ex) when (ex.Message == \"No ImageSource\")\n{\n    // prompt user to add a ControlNet input image\n}","preventionTips":["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."],"tags":["validation","comfyui","controlnet","missing-image"],"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-16T04:17:20.429Z"}