LykosAI/StabilityMatrix · error · NotSupportedException

Recycle bin is not available on this platform

Error message

Recycle bin is not available on this platform

What it means

ExecuteCurrentDeleteOperationAsync in ConfirmDeleteDialogViewModel performs a recycle-bin delete when IsPermanentDelete is false. Before calling NativeFileOperations.RecycleBin.MoveFilesToRecycleBinAsync it checks NativeFileOperations.IsRecycleBinAvailable and throws NotSupportedException when the current platform has no recycle-bin support. This prevents pretending a soft delete happened on platforms where it cannot.

Solutions

  1. Choose 'Delete permanently' in the delete dialog on platforms without recycle-bin support
  2. Update NativeFileOperations/recycle-bin backend to support the target platform (e.g. freedesktop Trash on Linux)
  3. In UI code, disable/hide the recycle-bin option when IsRecycleBinAvailable is false so the user never reaches this path
  4. Catch NotSupportedException and fall back to a permanent delete with a confirmation prompt

Example fix

// before
if (!NativeFileOperations.IsRecycleBinAvailable)
    throw new NotSupportedException("Recycle bin is not available on this platform");

// after
if (!NativeFileOperations.IsRecycleBinAvailable)
{
    Logger.Warn("Recycle bin unavailable; falling back to permanent delete");
    await DeletePermanentlyAsync(paths);
    return;
}
Defensive patterns

Strategy: fallback

Validate before calling

// Before showing the delete dialog
if (!NativeFileOperations.IsRecycleBinAvailable)
{
    confirmDeleteVm.IsPermanentDelete = true; // force permanent delete on unsupported platforms
}

Type guard

bool CanRecycle() => NativeFileOperations.IsRecycleBinAvailable;

Try / catch

try
{
    await confirmDeleteVm.ExecuteCurrentDeleteOperationAsync();
}
catch (NotSupportedException ex) when (ex.Message.Contains("Recycle bin"))
{
    Logger.Warn(ex, "Recycle bin unavailable; prompting for permanent delete");
    await ShowPermanentDeleteFallbackDialogAsync();
}

Prevention

When it happens

Trigger: Running the confirm-delete dialog with 'move to recycle bin' selected on a platform where NativeFileOperations.IsRecycleBinAvailable is false (e.g. Linux or macOS without a recycle-bin implementation).

Common situations: Users on Linux deleting models/images with the default non-permanent delete option; CI/headless environments without a desktop trash service; platform-specific builds lacking the native recycle-bin backend.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at StabilityMatrix.Avalonia/ViewModels/Dialogs/ConfirmDeleteDialogViewModel.cs:93

    }

    private bool IsValid()
    {
        return true;
    }

    public async Task ExecuteCurrentDeleteOperationAsync(bool ignoreErrors = false, bool failFast = false)
    {
        var paths = PathsToDelete;

        var exceptions = new List<Exception>();

        if (!IsPermanentDelete)
        {
            // Recycle bin
            if (!NativeFileOperations.IsRecycleBinAvailable)
            {
                throw new NotSupportedException("Recycle bin is not available on this platform");
            }

            try
            {
                await NativeFileOperations.RecycleBin.MoveFilesToRecycleBinAsync(paths);
            }
            catch (Exception e)
            {
                logger.LogWarning(e, "Failed to move path to recycle bin");

                if (!ignoreErrors)
                {
                    exceptions.Add(e);

                    if (failFast)
                    {
                        throw new AggregateException(exceptions);
                    }

View on GitHub (pinned to af93d6ef57)