This was an interesting error which I received while trying to uninstall SQL Server. In this blog, we would learn how to fix error Index was outside the bounds of the array, which might come during uninstallation of SQL Server.
I must say this was an unfortunate situation where my machine got crashed while SQL Server install was in progress. To get rid of the “incomplete” installation, I decided to remove it and install it again. I went to add/remove program and selected “uninstall” for SQL Server 2017 as I was welcomed by error – Index was outside the bounds of the array. I looked into Summary.txt file and found below.
Overall summary:
Final result: Failed: see details below
Exit code (Decimal): -2146233080
Exit facility code: 19
Exit error code: 5384
Exit message: Index was outside the bounds of the array.
Requested action: Uninstall
Further, I could see below in the same log.
This was the exception
Exception type: System.IndexOutOfRangeException
Message: Index was outside the bounds of the array.
HResult : 0x80131508
Stack:
at Microsoft.SqlServer.Configuration.InstallWizard.InstanceSelectionController.SaveData()
at Microsoft.SqlServer.Configuration.InstallWizardFramework.InstallWizardPageHost.PageLeaving(PageChangeReason reason)
at Microsoft.SqlServer.Configuration.WizardFramework.UIHost.set_SelectedPageIndex(Int32 value)
at Microsoft.SqlServer.Configuration.WizardFramework.NavigationButtons.nextButton_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Detail.txt also showed similar information
(06) 2018-11-25 09:48:24 Slp: Sco: Attempting to open registry subkey Software\Microsoft\Microsoft SQL Server\Instance Names
(06) 2018-11-25 09:48:24 Slp: Sco: Attempting to open registry subkey SQL
(06) 2018-11-25 09:48:24 Slp: Sco: Attempting to get registry value
(06) 2018-11-25 09:48:24 Slp: Sco: Attempting to open registry subkey OLAP
(06) 2018-11-25 09:48:24 Slp: Sco: Attempting to get registry value
(06) 2018-11-25 09:48:24 Slp: Sco: Attempting to open registry subkey RS
(06) 2018-11-25 09:48:24 Slp: No installed instance features found for InstanceName = ”
(06) 2018-11-25 09:48:24 Slp: Final InstallID = ‘cba7cce5-c24c-463d-8608-08fc78c8e678’
(06) 2018-11-25 09:48:24 Slp: End calculate InstallID
(01) 2018-11-25 09:48:27 Slp: Error: Action “Microsoft.SqlServer.Configuration.UIExtension.WaypointAction” threw an exception during execution.
WORKAROUND/SOLUTION
It was clear from the log that installation didn’t reach to the stage where it has to be configured. That’s why we are seeing <UNCONFIGURED> for the instance name.
Instead of UI, I decided to use the command line to install. So, I went to below folder.
C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\SQL2017
And use below the line in command prompt.
SETUP.EXE /ACTION=UNINTSALL
This time, I was able to get to the UI and choose “<UNCONFIGURED>” instance
… and remove SQL successfully.
I was unable to find out this trick on the internet. Hopefully, this would help someone who needs it.
Reference: Pinal Dave (https://blog.sqlauthority.com)
First appeared on SQL SERVER – Unable to Uninstall – Index was Outside the Bounds of the Array