Error: LibGit2Sharp.LibGit2SharpException: path too long

While working with Studio Community Edition I am getting this error frequently, it pops up on random occasions. Previously it was due to another path. I deleted that path file, and now it is a different path error.

MicrosoftTeams-image

22.4.3+Branch.master.Sha.926b4e643842c0bd04601053628fabcad850b6c3

path too long: ‘C:/Users/33826/AppData/Local/Microsoft/WINMSIPC/csr/EUL-{{14749636;j93A0;j4F52;jB473;j951FBBE8F893}}-{{5760d543;jaf45;j46bb;j8d1f;j5da6af603785}}-GIC-{dd4VJYh8+FJqc4M7VzquKf7skyM=}-{xdR;eySyaOhpLgMonNwK689SbI4A=}-{{7a8b0273;j0ec1;j4e0c;j9da4;j09bc97c64966}}.drm’

Error: LibGit2Sharp.LibGit2SharpException: path too long: ‘C:/Users/33826/AppData/Local/Microsoft/WINMSIPC/csr/EUL-{{14749636;j93A0;j4F52;jB473;j951FBBE8F893}}-{{5760d543;jaf45;j46bb;j8d1f;j5da6af603785}}-GIC-{dd4VJYh8+FJqc4M7VzquKf7skyM=}-{xdR;eySyaOhpLgMonNwK689SbI4A=}-{{7a8b0273;j0ec1;j4e0c;j9da4;j09bc97c64966}}.drm’
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Proxy.git_status_list_new(RepositoryHandle repo, GitStatusOptions options)
at LibGit2Sharp.RepositoryStatus…ctor(Repository repo, StatusOptions options)
at LibGit2Sharp.Repository.RetrieveStatus(StatusOptions options)
at UiPath.Studio.Plugin.Git.Services.RepositoryStatusService.RetrieveStatus(String repositoryPath, StatusOptions options, Action2 sandboxedAction) at UiPath.Studio.Plugin.Git.Services.ItemStatusService.GetItemStatusCore(String workingDirectory, String path, IGetStatusOptions options) at UiPath.Studio.Plugin.Git.Services.GitSession.ExecuteInternal[TResult](Func2 action, Func1 repoFactory) at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
— End of stack trace from previous location —
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
— End of stack trace from previous location —
at UiPath.Studio.Plugin.Git.Services.GitSession.SafeExecuteAsync[TResult](Func1 action) at UiPath.Studio.Plugin.Git.Services.GitSession.ExecuteAsync[TResult](Func1 action)
at UiPath.Studio.Plugin.Git.Services.ItemStatusService.GetItemStatusAsync(IGitSession session, String path, IGetStatusOptions options)
at UiPath.Studio.Plugin.Git.GitSourceControl.GetItemStatusAsync(String path, Boolean refreshCache)
at UiPath.Studio.SourceControl.Shared.Services.UI.BaseSourceControlUi1.RefreshBadgesAsync() at UiPath.Studio.Shell.SourceControl.SourceControlService.RefreshBadgesCore(IReadOnlyCollection1 paths, OperationType operationType)
at UiPath.Studio.Shell.SourceControl.SourceControlService.<>c__DisplayClass33_0.<<DocumentService_DocumentModified>b__0>d.MoveNext()
— End of stack trace from previous location —
at UiPath.Studio.Shared.MVVM.Services.DispatcherService.<>c__DisplayClass18_0.<b__0>d.MoveNext()
— End of stack trace from previous location —
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), HResult -2146233088

Hello @NotFranmax

The maximum character allowed is 260, so if the length is more than to that it will throw the error.

Please check whether the file full path is more than to this limit.

Thanks

Thank You for your reply, but this is not due to a custom path invoked/set in activity. It has something to do with Studio itself. If I open a blank new project and look at the screen, after a few minutes I will get this error.

Check the solution from here: Maximum Path Length Limitation - Win32 apps | Microsoft Learn

To enable the new long path behavior, both of the following conditions must be met:

  • The registry key Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled (Type: REG_DWORD) must exist and be set to 1. The key’s value will be cached by the system (per process) after the first call to an affected Win32 file or directory function (see below for the list of functions). The registry key will not be reloaded during the lifetime of the process. In order for all apps on the system to recognize the value of the key, a reboot might be required because some processes may have started before the key was set.

You can also copy this code to a .reg file which can set this for you, or use the PowerShell command from a terminal window with elevated privileges:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
"LongPathsEnabled"=dword:00000001

Example:

This registry key can also be controlled via Group Policy at Computer Configuration > Administrative Templates > System > Filesystem > Enable Win32 long paths > set to Enabled .

After you performed these changes, restart your machine and retry.

Let us know if this helped.

1 Like

Thank You, will try and come back

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.