SourceTree crashes on opening repository
Asked by James Harris:

I tried to open a second repository while a commit was in progress. SourceTree crashed and wouldn't re-open. I reinstalled and that didn't help, so I removed my AppData\\Local\\Atlassian folder. SourceTree then worked until I asked it to re-open that first repository, whereupon it crashed again and once again wouldn't re-open. git status doesn't show anything wrong with the repo. What can I do to get SourceTree working again?


Answers:
author: James Harris
body: I contacted Atlassian Support; they suggested I might be seeing this bug: <https://jira.atlassian.com/browse/SRCTREEWIN-3040>

The suggested workaround is:

* delete the contents of your C:\\Users\\\<username\>\\AppData\\Local\\Temp folder
* In the folder C:\\Users\\\<username\>\\AppData\\Local\\Atlassian\\SourceTree, there are some .txt files named after the pattern \<date\>_\<hash\>. Rename/move those files so SourceTree can't find them.

This fixed the problem for me.

comments: author: Cherny Berbes?
body: Saved my life. I was working with the shell but it takes more time to jump between branches. Thanks a lot :)


author: Paul Zurlinden
body: This worked for me too! Prior to finding this, I had all ready removed \\Local\\Atlassian\\SourceTree from my system, so I did not need to do this again. However, after repeatedly uninstalling/reinstalling, changing registry entries, etc. I still could not get SourceTree to open. It was only after deleting contents from \\Local\\Temp would SourceTree even try to start! Thanks James Harris!


author: tienha
body: Thanks @James Harris. This worked for me!


author: Jeff Barnes
body: Same problem but none of the above worked. Added comment to above Jira link. Here are additional steps I tried:

* Uninstalled SourceTree
* Rebooted
* Rename/Delete
  * all files +and folders+ in %localappdata%\\Temp
  * directory %localappdata%\\Atlassian\\SourceTree.exe_Url_\<hash\>
  * directory %localappdata%\\SourceTree
  * directory %localappdata%\\Squirrel
  * directory %ProgramFiles(x86)%\\Atlassian\\SourceTree (requires admin permission)


author: Pranab Jung Rana
body: Had the same problem and tried lot of solutions, but didn't work. This one did the trick perfectly. Just moved the files in sourcetree directory. Thanks [@James Harris6](/t5/user/viewprofilepage/user-id/671267).


author: DougTait
body: JAmes Harris .. LIFE.SAVER.

My PC shut down while a repository was open, and sourctree crashed every time I tried to re-open it (3 times in a row)

Deleting/renaming the files you suggested seems to have fixed it.

thank you !!


author: Anthony Robert
body: I've uninstall Sourcetree and install Sourcetree multiple times, the problems still happens to me when I try to change from a repository to another, Sourcetree doesn't crash if I open one of the repo, but if i open another one it crashes ... Please help me


author: Javier Otero
body: Hi.

For me the solution was delete **sourcetreeconfig.json** file under .git folder inside local repository folder.

Regards


author: Gavin Sinai
body: Thanks - delete temp files has worked - lifesaver


author: YishGene
body: Looking at the error logs in Event Viewer (Win7), I saw that the conflict was with git itself. I tried pulling the repo from the command line, this gave me some errors with STATing some of the folders, which is something that happens to me a lot when switching branches on matlab repos when matlab is running. Closed matlab, everything ok!


author: Eric Santarelli
body: I was having a similar problem, but the fix here didn't help, so I looked at EventViewer and found this interesting entry:

Faulting application path: C:\\Program Files\\Atlassian\\SourceTree\\SourceTree.exe

Faulting module path: C:\\Program Files\\Spybot - Search \& Destroy 2\\SDHook32.dll

Looks like this old version of Spybot (2.0.5.1) was causing problems with the latest version of SourceTree (1.6.14.0). I uninstalled it and SourceTree started working again, yai!

I've had Spybot installed on there for years but hadn't used this computer in a couple of months, and SourceTree used to work on it; it's possible that the incompatibility was introduced in a recent update.


author: david_gilbertson
body: Thanks @James Harris, deleting temp files fixed it for me.

This time away from SourceTree made me realise how awesome it is!


author: david_gilbertson
body: I did another uninstall/re-install but didn't add any repositories this time. I can now get in to **Tools** \> **Options,** but as soon as I click on the **Authentication** tab it crashes. So I guess that points to some setting being 'corrupted' in some way, but not related to any repo. The setting must be somewhere other than the Atlassian folders in program files or AppData/Local...


author: Mike Tully
body: I'm experiencing the same behavior as David for the last 2 days. Thought it was related to a windows update, but I restored to before the update and still have the same problem.

Windows 7  
SourceTree Version 1.6.14.0

Here's the sourcetree.log entry:

```
2015-03-10T15:46:33: Fatal error: System.IO.IOException: The file exists.2015-03-10T15:46:33: Stack trace:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)   at System.IO.Path.InternalGetTempFileName(Boolean checkHost)   at System.Windows.Input.Cursor.LoadFromStream(Stream cursorStream)   at System.Windows.Controls.GridViewColumnHeader.GetCursor(Int32 cursorID)   at System.Windows.Controls.GridViewColumnHeader.get_SplitCursor()   at System.Windows.Controls.GridViewColumnHeader.HookupGripperEvents()   at System.Windows.FrameworkElement.ApplyTemplate()   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.GridViewHeaderRowPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ScrollContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean&amp; hasDesiredSizeUChanged)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean&amp; hasDesiredSizeUChanged)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.ScrollViewer.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at Microsoft.Windows.Themes.ListBoxChrome.MeasureOverride(Size availableSize)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.DockPanel.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean&amp; hasDesiredSizeUChanged)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)   at System.Windows.Controls.ContentPresenter.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Border.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean&amp; hasDesiredSizeUChanged)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Control.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean&amp; hasDesiredSizeUChanged)   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)   at System.Windows.UIElement.Measure(Size availableSize)   at System.Windows.ContextLayoutManager.UpdateLayout()   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
```


author: david_gilbertson
body: Me too, happened just today. Windows 7 and the latest SourceTree.

I've tried uninstalling, removing the whole AppData\\Local\\Atlassian folder and re-installing. It opens, and I can open a new repository, but as soon as I try to open one of the repositories I was using previously it crashes.

And now (halfway through writing this) it won't open at all.

When it first occurred I had just gone into settings and changed something about which user to use for the repository.

Three errors show up in event viewer. the .NET Runtime logged error is:

```
Application: SourceTree.exeFramework Version: v4.0.30319Description: The process was terminated due to an unhandled exception.Exception Info: System.IO.IOExceptionStack:at System.Windows.Window.ShowDialog()at TaskDialogInterop.TaskDialog.ShowEmulatedTaskDialog(TaskDialogInterop.TaskDialogOptions)at TaskDialogInterop.TaskDialog.Show(TaskDialogInterop.TaskDialogOptions)at SourceTree.Utils.GeneralHelper.ShowMessageBox(System.String, System.String, System.String, System.String[], TaskDialogInterop.VistaTaskDialogIcon, System.String, System.String, System.String, TaskDialogInterop.VistaTaskDialogIcon)at SourceTree.AppRoot.HandleCrash(System.Exception)at SourceTree.AppRoot.DispatcherUnhandledExceptionHandler(System.Object, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs)at System.Windows.Threading.Dispatcher.CatchException(System.Exception)at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)at MS.Win32.HwndSubclass.DefWndProcWrapper(IntPtr, Int32, IntPtr, IntPtr)at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)at MS.Win32.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)at MS.Win32.UnsafeNativeMethods.SetWindowPos(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32, Int32, Int32)at MS.Win32.UnsafeNativeMethods.SetWindowPos(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32, Int32, Int32)at System.Windows.Window.SetupInitialState(Double, Double, Double, Double)at System.Windows.Window.CreateSourceWindow(Boolean)at System.Windows.Window.ShowHelper(System.Object)at System.Windows.Window.ShowDialog()at TaskDialogInterop.TaskDialog.ShowEmulatedTaskDialog(TaskDialogInterop.TaskDialogOptions)at TaskDialogInterop.TaskDialog.Show(TaskDialogInterop.TaskDialogOptions)at SourceTree.Utils.GeneralHelper.ShowMessageBox(System.String, System.String, System.String, System.String[], TaskDialogInterop.VistaTaskDialogIcon, System.String, System.String, System.String, TaskDialogInterop.VistaTaskDialogIcon)at SourceTree.AppRoot.HandleCrash(System.Exception)at SourceTree.AppRoot.DispatcherUnhandledExceptionHandler(System.Object, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs)at System.Windows.Threading.Dispatcher.CatchException(System.Exception)at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)at System.Windows.Threading.DispatcherOperation.InvokeImpl()at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)at System.Windows.Threading.DispatcherOperation.Invoke()at System.Windows.Threading.Dispatcher.ProcessQueue()at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)at System.Windows.Application.RunInternal(System.Windows.Window)at System.Windows.Application.Run()at SourceTree.App.Main()
```


author: ocococ
body: Same problem here too : systematic crash when opening a newly cloned repository in Source Tree.

First fresh install of SourceTree 1.6.14.0 under Windows 8.1.

No problem at all on Mac.

```
Problem signature:  Problem Event Name:    CLR20r3  Problem Signature 01:    SourceTree.exe  Problem Signature 02:    1.6.14.0  Problem Signature 03:    54ea9dbe  Problem Signature 04:    mscorlib  Problem Signature 05:    4.0.30319.34014  Problem Signature 06:    52e0b676  Problem Signature 07:    4797  Problem Signature 08:    15  Problem Signature 09:    System.Windows.Markup.XamlParse  OS Version:    6.3.9600.2.0.0.256.4  Locale ID:    1036  Additional Information 1:    8229  Additional Information 2:    82291666874e4851f6a1f358641f58fe  Additional Information 3:    c5e3  Additional Information 4:    c5e330202c92bb608c2caebba3e83405
```


author: James Harris
body: And the signature from the second "SourceTree has stopped working" window that comes up after I dismiss the first one:Problem signature: Problem Event Name: APPCRASH Application Name: SourceTree.exe Application Version: 1.6.14.0 Application Timestamp: 54ea9dbe Fault Module Name: KERNELBASE.dll Fault Module Version: 6.1.7601.18409 Fault Module Timestamp: 5315a05a Exception Code: c000041d Exception Offset: 000000000000940d OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1033 Additional Information 1: cb1d Additional Information 2: cb1d5081ae75d25ba5fcdd8622ae2654 Additional Information 3: 4b4e Additional Information 4: 4b4eed6de7b30fa8fda2d3d21f61ec59


author: James Harris
body: I'm running Windows 7. Here's the problem signature:Problem signature: Problem Event Name: CLR20r3 Problem Signature 01: sourcetree.exe Problem Signature 02: 1.6.14.0 Problem Signature 03: 54ea9dbe Problem Signature 04: mscorlib Problem Signature 05: 4.0.30319.18444 Problem Signature 06: 52717d7e Problem Signature 07: 4427 Problem Signature 08: 9a Problem Signature 09: System.IO.IOException OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1033 Additional Information 1: 8379 Additional Information 2: 83794c20b18404a64c9395020af43d45 Additional Information 3: c4d1 Additional Information 4: c4d183333186e4c6936d30ad4def6b76


Tags: crash

repository