{"record":{"id":"7343b88433abccab","repo":"BCUninstaller/Bulk-Crap-Uninstaller","slug":"failed-to-call-the-api","errorCode":null,"errorMessage":"Failed to call the API","messagePattern":"Failed to call the API","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"source/BulkCrapUninstaller/Functions/Tools/SystemRestore.cs","lineNumber":46,"sourceCode":"        /// <param name=\"displayMessage\">If user should be asked to create the restore point. If false, always create</param>\r\n        /// <param name=\"owner\">Window to show on top of</param>\r\n        public static bool BeginSysRestore(int count, bool displayMessage = true, Form owner = null)\r\n        {\r\n            if (!SysRestore.SysRestoreAvailable()) return false;\r\n\r\n            // If a restore is already running, do not start another one\r\n            if (_currentRestoreId != long.MinValue) return true;\r\n\r\n            switch (displayMessage ? MessageBoxes.SysRestoreBeginQuestion() : MessageBoxes.PressedButton.Yes)\r\n            {\r\n                case MessageBoxes.PressedButton.Yes:\r\n                    var error = LoadingDialog.ShowDialog(owner, Localisable.LoadingDialogTitleCreatingRestorePoint, x =>\r\n                    {\r\n                        EndSysRestore();\r\n\r\n                        var result = SysRestore.StartRestore(MessageBoxes.GetSystemRestoreDescription(count), out _currentRestoreId, 3);\r\n                        if (result < 0)\r\n                            throw new IOException(Localisable.SysRestoreGenericError);\r\n                    });\r\n\r\n                    return error == null ||\r\n                           MessageBoxes.SysRestoreContinueAfterError(error.Message) ==\r\n                           MessageBoxes.PressedButton.Yes;\r\n\r\n                default:\r\n                case MessageBoxes.PressedButton.No:\r\n                case MessageBoxes.PressedButton.Cancel:\r\n                    return false;\r\n            }\r\n        }\r\n\r\n        /// <summary>\r\n        ///     Cancel running restore if any\r\n        /// </summary>\r\n        public static void CancelSysRestore()\r\n        {\r","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/BCUninstaller/Bulk-Crap-Uninstaller/blob/608321de98e92297377b1eb69029af55c25504a1/source/BulkCrapUninstaller/Functions/Tools/SystemRestore.cs#L28-L64","documentation":"BeginSysRestore calls the native System Restore API (SRSetRestorePoint) via SysRestore.StartRestore, which returns a numeric result; a negative value means the API call failed. This IOException (SysRestoreGenericError) wraps that failure and is surfaced through the loading dialog, after which the user is asked whether to continue without a restore point.","triggerScenarios":"System Restore service disabled or stopped; running without administrator rights; System Protection disabled on all drives; Volume Shadow Copy / provider services down; insufficient free space for shadow copies.","commonSituations":"User disabled System Protection; non-elevated BCU; SR service stopped by policy; disk full for shadow storage.","solutions":["Run BCU as administrator.","Enable System Protection on the system drive.","Start the Volume Shadow Copy and Microsoft Software Shadow Copy Provider services.","Free disk space / increase shadow storage for restore points."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!SysRestore.SysRestoreAvailable()) { /* warn, skip restore point */ }","typeGuard":null,"tryCatchPattern":"try { BeginSysRestore(count, true, owner); }\ncatch (IOException) { /* ask user whether to continue without a restore point */ }","preventionTips":["Check SysRestoreAvailable() and elevation before attempting restore.","Surface failures gracefully and let the user continue."],"tags":["system-restore","permissions","windows-api"],"backgroundTag":null,"analyzedSha":"608321de98e92297377b1eb69029af55c25504a1","analyzedAt":"2026-08-13T12:17:35.389Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}