{"record":{"id":"173851753a29a77b","repo":"LykosAI/StabilityMatrix","slug":"file-does-not-contain-smproject-or-parameters-metadata","errorCode":null,"errorMessage":"File does not contain SMProject or Parameters Metadata","messagePattern":"File does not contain SMProject or Parameters Metadata","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Base/InferenceTabViewModelBase.cs","lineNumber":320,"sourceCode":"            {\n                Logger.Warn(\n                    \"Load parameters target {Type} does not implement IParametersLoadableState, skipping\",\n                    GetType().Name\n                );\n            }\n\n            // Load image\n            if (this is IImageGalleryComponent imageGalleryComponent)\n            {\n                Dispatcher.UIThread.Invoke(() =>\n                    imageGalleryComponent.LoadImagesToGallery(new ImageSource(imageFilePath))\n                );\n            }\n\n            return;\n        }\n\n        throw new ApplicationException(\"File does not contain SMProject or Parameters Metadata\");\n    }\n\n    /// <inheritdoc />\n    public void DragOver(object? sender, DragEventArgs e)\n    {\n        // 1. Context drop for LocalImageFile\n        if (e.Data.GetDataFormats().Contains(\"Context\"))\n        {\n            if (e.Data.GetContext<LocalImageFile>() is { } imageFile)\n            {\n                e.Handled = true;\n                return;\n            }\n\n            e.DragEffects = DragDropEffects.None;\n        }\n        // 2. OS Files\n        if (e.Data.GetDataFormats().Contains(DataFormats.Files))","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Base/InferenceTabViewModelBase.cs#L302-L338","documentation":"LoadImageMetadata expects a dropped/opened image to embed either an SMProject or Parameters metadata payload. If neither is found after all checks, it throws this ApplicationException instead of silently opening a parameter-less tab. It signals that the file is not a Stability Matrix inference image.","triggerScenarios":"Calling LoadImageMetadata (via Drop or AddTabFromFileAsync) on an ordinary image (photo, externally generated image, image with metadata stripped) that has no SMProject or Parameters entries in its embedded metadata.","commonSituations":"Dragging a downloaded or screenshot image into the Inference tab expecting prompt recovery; images saved through tools that strip EXIF/PNG metadata; images generated outside Stability Matrix without compatible metadata.","solutions":["Open the file normally (as an image) instead of via the inference metadata loader","Obtain the original image exported by Stability Matrix with intact metadata","Catch the ApplicationException and show a user-facing 'no embedded generation metadata' message","Manually reconstruct the prompt/settings in the Inference tab"],"exampleFix":"// before\nthrow new ApplicationException(\"File does not contain SMProject or Parameters Metadata\");\n\n// after\nLogger.Warn(\"No SMProject/Parameters metadata in file; opening without parameters\");\nOpenImageWithoutMetadata(file); // graceful fallback\nreturn;","handlingStrategy":"validation","validationCode":"// Before calling LoadImageMetadata\nvar meta = ImageMetadata.TryExtract(filePath);\nif (meta is null || (meta.SMProject is null && meta.Parameters is null && meta.CivitParameters is null))\n{\n    Logger.Warn(\"File has no SMProject/Parameters metadata; opening as plain image\");\n    return;\n}","typeGuard":"bool HasGenerationMetadata(ImageMetadata m) =>\n    m is not null && (m.SMProject is not null || m.Parameters is not null || m.CivitParameters is not null);","tryCatchPattern":"try\n{\n    tabVm.LoadImageMetadata(sender, filePath);\n}\ncatch (ApplicationException ex) when (ex.Message.Contains(\"SMProject or Parameters\"))\n{\n    Logger.Warn(ex, \"No generation metadata; falling back to plain image open\");\n    tabVm.OpenAsPlainImage(filePath);\n}","preventionTips":["Only drag images exported by Stability Matrix into the Inference tab expecting prompt recovery","Check for embedded metadata before attempting a metadata-driven load","Warn users when a file has no metadata instead of throwing","Avoid re-saving inference images through tools that strip metadata"],"tags":["metadata","missing-metadata","inference","drag-drop"],"backgroundTag":"missing-metadata","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"}