UiPath.Studio.OnlineServices.Models.CloudHttpException: Unauthorized

How to solve the UiPath.Studio.OnlineServices.Models.CloudHttpException: Unauthorized error while trying to Sync to Cloud using UiPath Studio Desktop?

Issue Description

While trying to Sync to Cloud (to UiPath Studio Web) an UiPath Studio local project, the below error may occur

Error: UiPath.Studio.OnlineServices.Models.CloudHttpException: Unauthorized

at UiPath.Studio.Orchestrator.Common.Services.CloudClientService.StatusCodeHandlerAsync(HttpResponseMessage response)

at UiPath.Studio.OnlineServices.Services.CloudApiClient.InternalRequestAsync[T](Uri uri, HttpMethod method, HttpContent content, Func`2 parseResponse, TimeSpan timeout, Dictionary`2 headers, CancellationToken ct)

at UiPath.Studio.OnlineServices.Services.CloudApiClient.RequestAsync(Uri uri, HttpMethod method, HttpContent content, TimeSpan timeout, Dictionary`2 headers, CancellationToken ct)

at UiPath.Studio.OnlineServices.Services.CloudApiClient.RequestAsync[T](Uri uri, HttpMethod method, HttpContent content, TimeSpan timeout, Dictionary`2 headers, CancellationToken ct)

at UiPath.Studio.WebProjects.Services.StudioWebClientService.UploadProjectAsync(WebProject webProject, MemoryStream archiveStream, Dictionary`2 headers, MemoryStream entryPointsStream)

at UiPath.Studio.WebProjects.Services.WebProjectUploadService.UploadProject(WebProject webProject, Func`3 upload)

at UiPath.Studio.WebProjects.Services.WebProjectUploadService.UploadAsync(WebProject webProject)

at UiPath.Studio.WebProjects.Services.WebProjectService.SaveToCloudAsync(WebProject webProject)

at UiPath.Studio.WebProjects.Services.WebProjectOperations.SaveNewToCloudAsync(String projectPath)

at UiPath.Studio.WebProjects.ViewModels.WebProjectPopupViewModel.ExecuteSaveNewToCloud()

at UiPath.Studio.App.Desktop.MVVM.Commands.TaskCommand`3.Execute(TExecuteParameter parameter, Boolean ignoreCanExecuteCheck)

at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)

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

Root Cause

A deployed Studio Web Automation Ops policy had the Allow users to import projects feature set to No.

Note: By default this feature is enabled.

Resolution

  1. Edit the Studio Web Automation Ops policy and enable the Allow users to import projects feature -> Save

  1. Close UiPath Studio desktop
  2. Access UiPath Assistant -> Preferences -> Orchestrator Settings -> Sign Out -> Disconnect
  3. Access UiPath Assistant -> Preferences -> Orchestrator Settings -> Connect -> Sign In
  4. Open the UiPath Studio desktop project and retry to perform Sync to Cloud

This enabled feature will allow importing Studio Web projects (.uip files).

Note: If the issue persists, please navigate to Automation Ops and remove the policy along with the associated user, group, or tenant. Afterward, recreate them. This action will trigger necessary changes in the cloud backend.