Tenant Not Found(#1667) - Host License View

When trying to open the Host License view after deleting a tenant through API, the following error is thrown "Tenant not Found(#1667) ".

Issue Description:
In some scenarios after deleting a tenant through API, the following error may be thrown when trying to access the License view on the Host tenant:

In the Event Viewer logs, the following error is noticed:

UiPath.Orchestrator.Core.Exceptions.NotFoundException: Error code - 1667, Message - 'Tenant not found.'

at async Task UiPath.Orchestrator.Core.Services.MultiTenancy.TenantManager.GetByIdAsync(int id)

at async Task Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous(IInvocation invocation)

at async Task UiPath.Orchestrator.Application.Services.LicenseService.CreateStatsRequest(int days, int tenantId)

at async Task<List> UiPath.Orchestrator.Application.Services.LicenseService.GetRobotLicenseStatsAsync(int days, int tenantId)

at async Task Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous(IInvocation invocation)

at async Task Abp.Runtime.Validation.Interception.ValidationInterceptor.InternalInterceptAsynchronous(IInvocation invocation)

at async Task UiPath.Orchestrator.Web.Api.Api.Controllers.StatsController.GetLicenseStats(int tenantId, int days)

at async ValueTask Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object controller, object[] arguments)

at async Task Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()+Logged(?)

at async Task Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()+Awaited(?)

at void Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)

at Task Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)

at async Task Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()+Awaited(?)

at async Task Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextExceptionFilterAsync()+Awaited(?)

Root Cause:
It is possible that the old deleted tenant is saved in the cache and because of that the Orchestrator is still making API calls to retrieve. Since it no longer exists the above error is thrown.


Resolution:

  • Clear the cache and cookies from the browser.