{"record":{"id":"1c81546212deecdb","repo":"LykosAI/StabilityMatrix","slug":"recycle-bin-is-not-available-on-this-platform","errorCode":null,"errorMessage":"Recycle bin is not available on this platform","messagePattern":"Recycle bin is not available on this platform","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"StabilityMatrix.Avalonia/ViewModels/Dialogs/ConfirmDeleteDialogViewModel.cs","lineNumber":93,"sourceCode":"    }\n\n    private bool IsValid()\n    {\n        return true;\n    }\n\n    public async Task ExecuteCurrentDeleteOperationAsync(bool ignoreErrors = false, bool failFast = false)\n    {\n        var paths = PathsToDelete;\n\n        var exceptions = new List<Exception>();\n\n        if (!IsPermanentDelete)\n        {\n            // Recycle bin\n            if (!NativeFileOperations.IsRecycleBinAvailable)\n            {\n                throw new NotSupportedException(\"Recycle bin is not available on this platform\");\n            }\n\n            try\n            {\n                await NativeFileOperations.RecycleBin.MoveFilesToRecycleBinAsync(paths);\n            }\n            catch (Exception e)\n            {\n                logger.LogWarning(e, \"Failed to move path to recycle bin\");\n\n                if (!ignoreErrors)\n                {\n                    exceptions.Add(e);\n\n                    if (failFast)\n                    {\n                        throw new AggregateException(exceptions);\n                    }","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/LykosAI/StabilityMatrix/blob/af93d6ef57c01cd890d7e0ad0a9ea8c9fcda3002/StabilityMatrix.Avalonia/ViewModels/Dialogs/ConfirmDeleteDialogViewModel.cs#L75-L111","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Choose 'Delete permanently' in the delete dialog on platforms without recycle-bin support","Update NativeFileOperations/recycle-bin backend to support the target platform (e.g. freedesktop Trash on Linux)","In UI code, disable/hide the recycle-bin option when IsRecycleBinAvailable is false so the user never reaches this path","Catch NotSupportedException and fall back to a permanent delete with a confirmation prompt"],"exampleFix":"// before\nif (!NativeFileOperations.IsRecycleBinAvailable)\n    throw new NotSupportedException(\"Recycle bin is not available on this platform\");\n\n// after\nif (!NativeFileOperations.IsRecycleBinAvailable)\n{\n    Logger.Warn(\"Recycle bin unavailable; falling back to permanent delete\");\n    await DeletePermanentlyAsync(paths);\n    return;\n}","handlingStrategy":"fallback","validationCode":"// Before showing the delete dialog\nif (!NativeFileOperations.IsRecycleBinAvailable)\n{\n    confirmDeleteVm.IsPermanentDelete = true; // force permanent delete on unsupported platforms\n}","typeGuard":"bool CanRecycle() => NativeFileOperations.IsRecycleBinAvailable;","tryCatchPattern":"try\n{\n    await confirmDeleteVm.ExecuteCurrentDeleteOperationAsync();\n}\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"Recycle bin\"))\n{\n    Logger.Warn(ex, \"Recycle bin unavailable; prompting for permanent delete\");\n    await ShowPermanentDeleteFallbackDialogAsync();\n}","preventionTips":["Hide or disable the recycle-bin option when IsRecycleBinAvailable is false","On Linux/macOS, expect soft-delete to be unavailable unless a backend is implemented","Default the delete dialog to permanent delete on unsupported platforms","Inform users before deletion that files cannot be recovered"],"tags":["platform","recycle-bin","delete","not-supported"],"backgroundTag":"unsupported-platform","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"}