bitwarden/server · error · BadRequestException
Provider admin not found.
Error message
Provider admin not found.
What it means
Thrown by ProviderService.InitiateDeleteAsync when no user account exists for providerAdminEmail (userRepository.GetByEmailAsync returns null). The admin who authorizes provider deletion must be a real account. BadRequestException (HTTP 400).
Source
Thrown at bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs:689
{
await _eventService.LogProviderOrganizationEventAsync(providerOrganization, EventType.ProviderOrganization_VaultAccessed);
}
if (organization != null)
{
await _eventService.LogOrganizationEventAsync(organization, EventType.Organization_VaultAccessed);
}
}
public async Task InitiateDeleteAsync(Provider provider, string providerAdminEmail)
{
if (string.IsNullOrWhiteSpace(provider.Name))
{
throw new BadRequestException("Provider name not found.");
}
var providerAdmin = await _userRepository.GetByEmailAsync(providerAdminEmail);
if (providerAdmin == null)
{
throw new BadRequestException("Provider admin not found.");
}
var providerAdminOrgUser = await _providerUserRepository.GetByProviderUserAsync(provider.Id, providerAdmin.Id);
if (providerAdminOrgUser == null || providerAdminOrgUser.Status != ProviderUserStatusType.Confirmed ||
providerAdminOrgUser.Type != ProviderUserType.ProviderAdmin)
{
throw new BadRequestException("Org admin not found.");
}
var token = _providerDeleteTokenDataFactory.Protect(new ProviderDeleteTokenable(provider, 1));
await _mailService.SendInitiateDeletProviderEmailAsync(providerAdminEmail, provider, token);
}
public async Task DeleteAsync(Provider provider, string token)
{
if (!_providerDeleteTokenDataFactory.TryUnprotect(token, out var data) || !data.Valid || !data.IsValid(provider))
{
throw new BadRequestException("Invalid token.");View on GitHub (pinned to e93b962371)
Solutions
- Confirm the admin email matches an existing User account (GetByEmailAsync) before initiating deletion.
- Use the exact email casing stored on the user record.
- If the admin lacks an account, create/invite them first.
Example fix
// before
await providerService.InitiateDeleteAsync(provider, adminEmail);
// after
var admin = await _userRepository.GetByEmailAsync(adminEmail);
if (admin == null)
{
return BadRequest("No account found for the given admin email.");
}
await providerService.InitiateDeleteAsync(provider, adminEmail); Defensive patterns
Strategy: validation
Validate before calling
var admin = await userRepository.GetByEmailAsync(adminEmail);
if (admin == null) return BadRequest("Admin account not found."); Prevention
- Use the exact registered admin email.
- Confirm the admin account exists before deletion.
When it happens
Trigger: Calling InitiateDeleteAsync with an email that does not match any User (wrong address, unregistered admin, wrong-case lookup if the store is case-sensitive).
Common situations: Typo in the admin email; admin account not yet created; using a personal alias that differs from the registered email; case mismatch in the stored email.
Related errors
- Provider name not found.
- Org admin not found.
- Invalid owner. Owner must be an existing Bitwarden user.
- Invalid owner.
- User invalid.
AI-assisted analysis of bitwarden/server@e93b962371 (2026-08-13).
Data as JSON: /api/errors/32ec235daad8af90.
Report an issue: GitHub.