Job Throwing Error " Value Cannot Be Null" Error For NuGet Folder Path

How to set NuGetEnvironment environment variable?

Issue: Unable to trigger a job from orchestrator after upgrading to 21.10.x as NuGetEnvironment is taking null FolderPath.

Error Message:

RemoteException wrapping System.ArgumentNullException: Value cannot be null. (Parameter 'path1')

at System.IO.Path.Combine(String path1, String path2)

at NuGet.Common.NuGetEnvironment.GetFolderPath(NuGetFolderPath folder)

at NuGet.Configuration.Settings.LoadUserSpecificSettings(String root, String configFileName, Boolean useTestingGlobalPath, SettingsLoadingContext settingsLoadingContext)+MoveNext()

at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)



How to Troubleshoot The Issue:

  1. Check the stack trace of the error. If it is throwing error while fetching and creating the nuget folder path "at NuGet.Common.NuGetEnvironment.GetFolderPath" then try below steps.
  1. Check the environment variable using the psexec tool: https://learn.microsoft.com/en-us/sysinternals/downloads/psexec
    1. Start command line as administrator and run PsExec64.exe /s cmd
    2. Above command will open the cmd under local system account. Now run command echo %APPDATA%
    3. the expected result should be: C:\WINDOWS\system32\config\systemprofile\AppData\Roaming


Expected Result:

But for this issue, %APPDATA% value will be empty or return same echo keyword. i.e. %APPDATA%.

Resolution:

  1. As long as the the %APPDATA% is set to that value, it should be fine. If echo %APPDATA% returns "C:\WINDOWS\system32\config\systemprofile\AppData\Roaming", it would mean that the variable is already set and has the correct value. There is no need to set it anymore.

  1. If empty value is obtained, set it using the below commands:
  1. Use the setx command in Windows to set the value of the APPDATA environment variable to a specific path.

  1. In case above does not help, generate the diagnostic tool log from "UiPath Assistant --> preferences --> tools --> start diagnostic tool" and open a ticket with UiPath technical support team.