[Windows 10] Sourcetree fails to install
Asked by ajjohnson1996:

Sourcetree was crashing right after starting, so I decided to completely reinstall it. I deleted the Atlassian and Sourcetree folder in my local folder. The first time running the setup executable SquirrelSetup.log outputs this:

2019-02-05 12:56:08\> Program: Starting Squirrel Updater: --install .  
2019-02-05 12:56:09\> Program: Starting install, writing to C:\\Users\\AlexJ\\AppData\\Local\\SquirrelTemp  
2019-02-05 12:56:09\> Program: About to install to: C:\\Users\\AlexJ\\AppData\\Local\\SourceTree  
2019-02-05 12:56:09\> CheckForUpdateImpl: Couldn't write out staging user ID, this user probably shouldn't get beta anything: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\packages\\.betaId'.  
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, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)  
at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)  
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)  
at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)  
at System.IO.File.WriteAllText(String path, String contents, Encoding encoding)  
at Squirrel.UpdateManager.CheckForUpdateImpl.getOrCreateStagedUserId()  
2019-02-05 12:56:09\> CheckForUpdateImpl: Failed to load local releases, starting from scratch: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\packages\\RELEASES'.  
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)  
at Squirrel.Utility.LoadLocalReleases(String localReleaseFile)  
at Squirrel.UpdateManager.CheckForUpdateImpl.\<CheckForUpdate\>d__2.MoveNext()  
2019-02-05 12:56:09\> CheckForUpdateImpl: Reading RELEASES file from C:\\Users\\AlexJ\\AppData\\Local\\SquirrelTemp  
2019-02-05 12:56:09\> CheckForUpdateImpl: First run or local directory is corrupt, starting from scratch  
2019-02-05 12:56:09\> ApplyReleasesImpl: Writing files to app directory: C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\app-3.0.15  
2019-02-05 12:56:11\> LogHost: Rigging execution stub for SourceTree_ExecutionStub.exe to C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\SourceTree.exe  
2019-02-05 12:56:12\> ApplyReleasesImpl: Squirrel Enabled Apps: \[C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\app-3.0.15\\SourceTree.exe\]  
2019-02-05 12:56:16\> ApplyReleasesImpl: Starting fixPinnedExecutables  
2019-02-05 12:56:16\> ApplyReleasesImpl: Examining Pin: File Explorer.lnk  
2019-02-05 12:56:16\> ApplyReleasesImpl: Examining Pin: Google Chrome.lnk  
2019-02-05 12:56:16\> ApplyReleasesImpl: Examining Pin: iTunes.lnk  
2019-02-05 12:56:16\> ApplyReleasesImpl: Fixing up tray icons  
2019-02-05 12:56:16\> ApplyReleasesImpl: cleanDeadVersions: for version 3.0.15  
2019-02-05 12:56:16\> ApplyReleasesImpl: cleanDeadVersions: exclude folder app-3.0.15

When I run it again, it outputs this:

2019-02-05 12:56:08\> Program: Starting Squirrel Updater: --install .  
2019-02-05 12:56:09\> Program: Starting install, writing to C:\\Users\\AlexJ\\AppData\\Local\\SquirrelTemp  
2019-02-05 12:56:09\> Program: About to install to: C:\\Users\\AlexJ\\AppData\\Local\\SourceTree  
2019-02-05 12:56:09\> CheckForUpdateImpl: Couldn't write out staging user ID, this user probably shouldn't get beta anything: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\packages\\.betaId'.  
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, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)  
at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)  
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)  
at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding, Boolean checkHost)  
at System.IO.File.WriteAllText(String path, String contents, Encoding encoding)  
at Squirrel.UpdateManager.CheckForUpdateImpl.getOrCreateStagedUserId()  
2019-02-05 12:56:09\> CheckForUpdateImpl: Failed to load local releases, starting from scratch: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\packages\\RELEASES'.  
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)  
at Squirrel.Utility.LoadLocalReleases(String localReleaseFile)  
at Squirrel.UpdateManager.CheckForUpdateImpl.\<CheckForUpdate\>d__2.MoveNext()  
2019-02-05 12:56:09\> CheckForUpdateImpl: Reading RELEASES file from C:\\Users\\AlexJ\\AppData\\Local\\SquirrelTemp  
2019-02-05 12:56:09\> CheckForUpdateImpl: First run or local directory is corrupt, starting from scratch  
2019-02-05 12:56:09\> ApplyReleasesImpl: Writing files to app directory: C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\app-3.0.15  
2019-02-05 12:56:11\> LogHost: Rigging execution stub for SourceTree_ExecutionStub.exe to C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\SourceTree.exe  
2019-02-05 12:56:12\> ApplyReleasesImpl: Squirrel Enabled Apps: \[C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\app-3.0.15\\SourceTree.exe\]  
2019-02-05 12:56:16\> ApplyReleasesImpl: Starting fixPinnedExecutables  
2019-02-05 12:56:16\> ApplyReleasesImpl: Examining Pin: File Explorer.lnk  
2019-02-05 12:56:16\> ApplyReleasesImpl: Examining Pin: Google Chrome.lnk  
2019-02-05 12:56:16\> ApplyReleasesImpl: Examining Pin: iTunes.lnk  
2019-02-05 12:56:16\> ApplyReleasesImpl: Fixing up tray icons  
2019-02-05 12:56:16\> ApplyReleasesImpl: cleanDeadVersions: for version 3.0.15  
2019-02-05 12:56:16\> ApplyReleasesImpl: cleanDeadVersions: exclude folder app-3.0.15  
2019-02-05 12:59:00\> Program: Starting Squirrel Updater: --install .  
2019-02-05 12:59:00\> Program: Starting install, writing to C:\\Users\\AlexJ\\AppData\\Local\\SquirrelTemp  
2019-02-05 12:59:00\> Program: About to install to: C:\\Users\\AlexJ\\AppData\\Local\\SourceTree  
2019-02-05 12:59:00\> Program: Install path C:\\Users\\AlexJ\\AppData\\Local\\SourceTree already exists, burning it to the ground  
2019-02-05 12:59:00\> IEnableLogger: Failed to remove existing directory on full install, is the app still running???: System.UnauthorizedAccessException: Access to the path 'C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\app-3.0.15\\Atlassian.AnalyticsService.Client.dll' is denied.  
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)  
at System.IO.File.InternalDelete(String path, Boolean checkHost)  
at System.IO.File.Delete(String path)  
at Squirrel.Utility.\<\>c.\<DeleteDirectory\>b__19_0(String file)  
at Squirrel.Utility.\<\>c__DisplayClass12_1\`1.\<ForEachAsync\>b__1()  
at System.Threading.Tasks.Task.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.Utility.\<\>c__DisplayClass13_0\`1.\<\<ForEachAsync\>b__1\>d.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 Squirrel.Utility.\<DeleteDirectory\>d__19.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 Squirrel.Utility.\<\>c.\<\<DeleteDirectory\>b__19_1\>d.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 Squirrel.Utility.\<\>c__DisplayClass13_0\`1.\<\<ForEachAsync\>b__1\>d.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 Squirrel.Utility.\<DeleteDirectory\>d__19.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 Squirrel.Utility.\<LogIfThrows\>d__42.MoveNext()  
2019-02-05 12:59:00\> Unhandled exception: System.AggregateException: One or more errors occurred. ---\> System.UnauthorizedAccessException: Access to the path 'C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\app-3.0.15\\Atlassian.AnalyticsService.Client.dll' is denied.  
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)  
at System.IO.File.InternalDelete(String path, Boolean checkHost)  
at System.IO.File.Delete(String path)  
at Squirrel.Utility.\<\>c.\<DeleteDirectory\>b__19_0(String file)  
at Squirrel.Utility.\<\>c__DisplayClass12_1\`1.\<ForEachAsync\>b__1()  
at System.Threading.Tasks.Task.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.Utility.\<\>c__DisplayClass13_0\`1.\<\<ForEachAsync\>b__1\>d.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 Squirrel.Utility.\<DeleteDirectory\>d__19.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 Squirrel.Utility.\<\>c.\<\<DeleteDirectory\>b__19_1\>d.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 Squirrel.Utility.\<\>c__DisplayClass13_0\`1.\<\<ForEachAsync\>b__1\>d.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 Squirrel.Utility.\<DeleteDirectory\>d__19.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 Squirrel.Utility.\<LogIfThrows\>d__42.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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)  
at Squirrel.Update.Program.\<Install\>d__4.MoveNext()  
--- End of inner exception stack trace ---  
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)  
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)  
at System.Threading.Tasks.Task.Wait()  
at Squirrel.Update.Program.executeCommandLine(String\[\] args)  
at Squirrel.Update.Program.main(String\[\] args)  
---\> (Inner Exception #0) System.UnauthorizedAccessException: Access to the path 'C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\app-3.0.15\\Atlassian.AnalyticsService.Client.dll' is denied.  
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)  
at System.IO.File.InternalDelete(String path, Boolean checkHost)  
at System.IO.File.Delete(String path)  
at Squirrel.Utility.\<\>c.\<DeleteDirectory\>b__19_0(String file)  
at Squirrel.Utility.\<\>c__DisplayClass12_1\`1.\<ForEachAsync\>b__1()  
at System.Threading.Tasks.Task.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.Utility.\<\>c__DisplayClass13_0\`1.\<\<ForEachAsync\>b__1\>d.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 Squirrel.Utility.\<DeleteDirectory\>d__19.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 Squirrel.Utility.\<\>c.\<\<DeleteDirectory\>b__19_1\>d.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 Squirrel.Utility.\<\>c__DisplayClass13_0\`1.\<\<ForEachAsync\>b__1\>d.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 Squirrel.Utility.\<DeleteDirectory\>d__19.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 Squirrel.Utility.\<LogIfThrows\>d__42.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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)  
at Squirrel.Update.Program.\<Install\>d__4.MoveNext()\<---

Any idea why it would do this and what I need to do to fix it?

<br />


Answers:
author: minnsey
body: Hi  

Looking at the 2nd log file, this is not really an error:  

2019-02-05 12:56:09\> CheckForUpdateImpl: Couldn't write out staging user ID, this user probably shouldn't get beta anything: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\packages\\.betaId'.  

You can ignore that. It is just an overzealous log message from the Squirrel.Windows installer.  

This looks more significant  

2019-02-05 12:59:00\> IEnableLogger: Failed to remove existing directory on full install, is the app still running???: System.UnauthorizedAccessException: Access to the path 'C:\\Users\\AlexJ\\AppData\\Local\\SourceTree\\app-3.0.15\\Atlassian.AnalyticsService.Client.dll' is denied.  

<br />

It looks like it is trying to overwrite/delete **Atlassian.analyticsservice.client.dll** I'd make sure nothing Sourcetree related is still running, perhaps restart your workstation. Unless a previous installer was run as administrator? That might cause a similar issue.  

The first log file *looks* like it completed successfully.  

After restarting and then re-running the installer, if Soucetree doesn't start automatically check the C:\\Users\\AlexJ\\AppData\\Local\\SourceTree folder. It should contain a Sourcetree.exe file and an app-3.0.15 folder.  

That Sourcetree.exe is actually a shortcut to app-3.0.15/sourcetree.exe. Try running Sourcetree.exe and if that doesn't work try app-3.0.15/sourcetree.exe.  

If Sourcetree fails to start it should log to %localappdata%/Atlassian/Sourcetree/sourcetree.log. Post any errors from there to this ticket.  

comments: author: ajjohnson1996
body: It fixed itself on its own, I have no idea why but it works now.