Sourcetree crashed and now all branches and repos are missing and it will not clone new repositories
Asked by Jake Render:

I switched branches from a local branch to one in out BitBucket repository and Sourcetree crashed. When I opened it back up, it no longer had any of the branches I use. It still knew my login and knew where the master branch resides online, but I'm unable to clone it as it says the path to the .git file is an invalid URL (it's not, it copy-pasted it from the BitBucket site).

I've managed to track down the log file and found the timestamps of the crash and my first attempt to re-open the file. All subsequent attempts have been repeats of the errors listed below.

The error mentions that it can't find a part of the path 'C:\\Users\\myUser\\AppData\\Local\\Temp\\2\\\<filename\>'. That folder is empty.

Here are the errors from the log:

ERROR \[2017-07-18 09:56:49,098\] \[1\] \[SourceTree.Analytics.Crash.BugSplat.CrashAnalyticsService\] \[DispatcherUnhandledExceptionHandler\] - DispatcherUnhandledExceptionHandler for \[SourceTree, 2.1.2.5\] called with \[System.Windows.Threading.Dispatcher, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs\]  
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\\Users\\myUser\\AppData\\Local\\Temp\\2\\3roeat2u.rdq'.  
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)  
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)  
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)  
at SourceTreeShared.TempFile.Create(String path)  
at SourceTree.Bookmarks.BookmarkManager.SaveBookmarks(List\`1 list, String folder)  
at SourceTree.Bookmarks.BookmarkManager.SaveBookmarks()  
at SourceTree.AppRoot.OnExit(ExitEventArgs e)  
at SourceTree.App.OnExit(ExitEventArgs e)  
at System.Windows.Application.DoShutdown()  
at System.Windows.Application.ShutdownImpl()  
at System.Windows.Application.ShutdownCallback(Object arg)  
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)  
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)  
ERROR \[2017-07-18 09:57:10,583\] \[1\] \[SourceTree.Utils.UpdateHelper+\<HasAvailableUpdates\>d__17\] \[MoveNext\] - Unable to check for Updates.  
System.Exception: Couldn't acquire lock, is another instance running  
at Squirrel.SingleGlobalInstance..ctor(String key, TimeSpan timeOut)  
at Squirrel.UpdateManager.\<acquireUpdateLock\>b__31_0()  
at System.Threading.Tasks.Task\`1.InnerInvoke()  
at System.Threading.Tasks.Task.Execute()  
--- End of stack trace from previous location where exception was thrown ---  
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)  
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)  
at Squirrel.UpdateManager.\<CheckForUpdate\>d__7.MoveNext()  
--- End of stack trace from previous location where exception was thrown ---  
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)  
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)  
at SourceTree.Utils.UpdateHelper.\<CheckForUpdate\>d__16.MoveNext()  
--- End of stack trace from previous location where exception was thrown ---  
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)  
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)  
at SourceTree.Utils.UpdateHelper.\<HasAvailableUpdates\>d__17.MoveNext()  
ERROR \[2017-07-18 09:57:16,695\] \[1\] \[SourceTree.Analytics.Crash.BugSplat.CrashAnalyticsService\] \[DispatcherUnhandledExceptionHandler\] - DispatcherUnhandledExceptionHandler for \[SourceTree, 2.1.2.5\] called with \[System.Windows.Threading.Dispatcher, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs\]  
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\\Users\\myUser\\AppData\\Local\\Temp\\2\\zsg31m0t.e1z'.  
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)  
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)  
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)  
at SourceTreeShared.TempFile.Create(String path)  
at SourceTree.Bookmarks.BookmarkManager.SaveBookmarks(List\`1 list, String folder)  
at SourceTree.Bookmarks.BookmarkManager.SaveBookmarks()  
at SourceTree.AppRoot.OnExit(ExitEventArgs e)  
at SourceTree.App.OnExit(ExitEventArgs e)  
at System.Windows.Application.DoShutdown()  
at System.Windows.Application.ShutdownImpl()  
at System.Windows.Application.ShutdownCallback(Object arg)  
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)  
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

I've uninstalled and reinstalled the sourcetree application, but have not yet touched any of the data in C:\\Users\\myUser\\AppData\\ as I don't know if I'll accidentally delete the data in my local branch.

Any assistance would be greatly appreciated. I have a week's worth of work in that local branch.


Answers:
author: minnsey
body: Hi  

First to re-assure you, any problems with SourceTree will not effect your actual git repositories, your branches are stored in git, SourceTree just reposrts them.  

At a guess, looking at the log, there was a problem saving the bookmarks file.  

I would suggest

* shutting down SourceTree
* deleting the file %localappdata%\\Atlassian\\SourceTree\\bookmarks.xml
* re-open SourceTree
* re-add the bookmark to your git repositories

You should then find all of your information is avialable again.

comments: author: Jake Render
body: Hi, Thanks for the response.

Unfortunately, that didn't help and I'm still unable to add any folders, or clone any repositories.

Hopefully the pictures attached come through. The folder is my existing working folder and the clone URL is copied directly from BitBucket.

This is not super urgent, as I'm able to use the Team Explorer in Visual Studio.

![add folder example.png](https://community.atlassian.com/t5/image/serverpage/image-id/3428i96F8BC8ACECF1EFD/image-dimensions/317x121?v=v2 "add folder example.png")![clone example.png](https://community.atlassian.com/t5/image/serverpage/image-id/3430i6354E44293F6F8D7/image-dimensions/391x274?v=v2 "clone example.png")

Thanks again for your help,

Jake


Tags: crash