LykosAI/StabilityMatrix · error · ApplicationException

File does not contain SMProject or Parameters Metadata

Error message

File does not contain SMProject or Parameters Metadata

What it means

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.

Solutions

  1. Open the file normally (as an image) instead of via the inference metadata loader
  2. Obtain the original image exported by Stability Matrix with intact metadata
  3. Catch the ApplicationException and show a user-facing 'no embedded generation metadata' message
  4. Manually reconstruct the prompt/settings in the Inference tab

Example fix

// before
throw new ApplicationException("File does not contain SMProject or Parameters Metadata");

// after
Logger.Warn("No SMProject/Parameters metadata in file; opening without parameters");
OpenImageWithoutMetadata(file); // graceful fallback
return;
Defensive patterns

Strategy: validation

Validate before calling

// Before calling LoadImageMetadata
var meta = ImageMetadata.TryExtract(filePath);
if (meta is null || (meta.SMProject is null && meta.Parameters is null && meta.CivitParameters is null))
{
    Logger.Warn("File has no SMProject/Parameters metadata; opening as plain image");
    return;
}

Type guard

bool HasGenerationMetadata(ImageMetadata m) =>
    m is not null && (m.SMProject is not null || m.Parameters is not null || m.CivitParameters is not null);

Try / catch

try
{
    tabVm.LoadImageMetadata(sender, filePath);
}
catch (ApplicationException ex) when (ex.Message.Contains("SMProject or Parameters"))
{
    Logger.Warn(ex, "No generation metadata; falling back to plain image open");
    tabVm.OpenAsPlainImage(filePath);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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

Appendix: source

Thrown at StabilityMatrix.Avalonia/ViewModels/Base/InferenceTabViewModelBase.cs:320

            {
                Logger.Warn(
                    "Load parameters target {Type} does not implement IParametersLoadableState, skipping",
                    GetType().Name
                );
            }

            // Load image
            if (this is IImageGalleryComponent imageGalleryComponent)
            {
                Dispatcher.UIThread.Invoke(() =>
                    imageGalleryComponent.LoadImagesToGallery(new ImageSource(imageFilePath))
                );
            }

            return;
        }

        throw new ApplicationException("File does not contain SMProject or Parameters Metadata");
    }

    /// <inheritdoc />
    public void DragOver(object? sender, DragEventArgs e)
    {
        // 1. Context drop for LocalImageFile
        if (e.Data.GetDataFormats().Contains("Context"))
        {
            if (e.Data.GetContext<LocalImageFile>() is { } imageFile)
            {
                e.Handled = true;
                return;
            }

            e.DragEffects = DragDropEffects.None;
        }
        // 2. OS Files
        if (e.Data.GetDataFormats().Contains(DataFormats.Files))

View on GitHub (pinned to af93d6ef57)