abpframework/abp · error · UserFriendlyException
Given tenant isn't available
Error message
Given tenant isn't available: {0} What it means
Thrown by TenantSwitchModal.OnPostAsync right after the tenant is found: the tenant record exists but tenant.IsActive is false, meaning it has been deactivated. ABP prevents switching the current tenant context to an inactive tenant via the localized 'GivenTenantIsNotAvailable' message.
Solutions
- Reactivate the tenant via the tenant management UI/API (set IsActive = true).
- Pick a different active tenant.
- Refresh the tenant list source so inactive tenants are no longer offered for switching.
Example fix
// before: switch to tenant that exists but IsActive == false -> not available // after: activate the tenant first await TenantManager.UpdateAsync(tenant.Id, x => x.IsActive = true);
Defensive patterns
Strategy: validation
Validate before calling
var tenant = await tenantStore.FindAsync(normalizedName);
if (tenant != null && !tenant.IsActive)
{
// tell the user the tenant is inactive; don't attempt the switch
} Type guard
null
Try / catch
try { await OnPostAsync(); }
catch (UserFriendlyException ex) when (ex.Code == "GivenTenantIsNotAvailable")
{ /* show localized 'tenant inactive' message */ } Prevention
- Filter the tenant switch list to active tenants only.
- Re-check tenant state immediately before switching for long sessions.
- Provide an admin path to reactivate tenants.
- Surface IsActive in the tenant picker UI.
When it happens
Trigger: Posting the tenant-switch modal with a name that resolves to a tenant whose IsActive flag is false.
Common situations: Tenant was deactivated/suspended by an admin but still appears in a cached or stale dropdown; an automation script switches to a tenant that was recently disabled; tenant deactivated mid-session.
Related errors
- Given tenant doesn't exist
- Container name contains invalid characters
- Container name must be between
- Invalid background job name filter mode
- Invalid directory path generated from blob name.
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/ec867f4867f28239.
Report an issue: GitHub.
Appendix: source
Thrown at framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs:58
var tenant = await TenantStore.FindAsync(CurrentTenant.GetId());
Input.Name = tenant?.Name;
}
}
public virtual async Task OnPostAsync()
{
Guid? tenantId = null;
if (!Input.Name.IsNullOrEmpty())
{
var tenant = await TenantStore.FindAsync(TenantNormalizer.NormalizeName(Input.Name!)!);
if (tenant == null)
{
throw new UserFriendlyException(L["GivenTenantIsNotExist", Input.Name!]);
}
if (!tenant.IsActive)
{
throw new UserFriendlyException(L["GivenTenantIsNotAvailable", Input.Name!]);
}
tenantId = tenant.Id;
}
AbpMultiTenancyCookieHelper.SetTenantCookie(HttpContext, tenantId, Options.TenantKey);
}
public class TenantInfoModel
{
[InputInfoText("SwitchTenantHint")]
public string? Name { get; set; }
}
}
View on GitHub (pinned to 7ed43b1931)