bitwarden/server · error · BadRequestException
Unsupported provider type {providerType}.
Error message
Unsupported provider type {providerType}. What it means
Thrown by ProviderService.ThrowOnInvalidPlanType in the default switch case when providerType is not one of Msp, BusinessUnit, or Reseller. This is a defensive guard: the ProviderType enum gained/lost a value, or a provider record has an out-of-range Type. BadRequestException (HTTP 400).
Source
Thrown at bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs:758
if (requestedType is not (PlanType.TeamsMonthly or PlanType.EnterpriseMonthly))
{
throw new BadRequestException($"Managed Service Providers cannot manage organizations with the plan type {requestedType}. Only Teams (Monthly) and Enterprise (Monthly) are allowed.");
}
break;
case ProviderType.BusinessUnit:
if (requestedType is not (PlanType.EnterpriseMonthly or PlanType.EnterpriseAnnually))
{
throw new BadRequestException($"Business Unit Providers cannot manage organizations with the plan type {requestedType}. Only Enterprise (Monthly) and Enterprise (Annually) are allowed.");
}
break;
case ProviderType.Reseller:
if (_resellerDisallowedOrganizationTypes.Contains(requestedType))
{
throw new BadRequestException($"Providers cannot manage organizations with the requested plan type ({requestedType}). Only Teams and Enterprise accounts are allowed.");
}
break;
default:
throw new BadRequestException($"Unsupported provider type {providerType}.");
}
}
private async Task UpdateClientOrganizationsEnabledStatusAsync(Guid providerId, bool enabled)
{
var providerOrganizations = await _providerOrganizationRepository.GetManyDetailsByProviderAsync(providerId);
foreach (var providerOrganization in providerOrganizations)
{
var organization = await _organizationRepository.GetByIdAsync(providerOrganization.OrganizationId);
if (organization != null && organization.Enabled != enabled)
{
organization.Enabled = enabled;
await _organizationRepository.ReplaceAsync(organization);
await _organizationAbilityCacheService.UpsertOrganizationAbilityAsync(organization);
}
}
}View on GitHub (pinned to e93b962371)
Solutions
- Add a case for the new ProviderType in ThrowOnInvalidPlanType, or migrate affected providers to a supported type.
- Correct the corrupt provider.Type value in the data store.
- Ensure all application tiers run a version that knows the full ProviderType enum.
Example fix
// before (default throws for an unhandled new enum)
case ProviderType.Msp: ...
case ProviderType.BusinessUnit: ...
case ProviderType.Reseller: ...
default: throw new BadRequestException($"Unsupported provider type {providerType}.");
// after (add explicit handling for the new type)
case ProviderType.NewKind:
if (requestedType is not PlanType.EnterpriseMonthly) throw new BadRequestException(...);
break; Defensive patterns
Strategy: validation
Validate before calling
if (!Enum.IsDefined(provider.Type) || provider.Type is not (ProviderType.Msp or ProviderType.BusinessUnit or ProviderType.Reseller))
return BadRequest("Unsupported provider type."); Type guard
static bool IsKnownProviderType(ProviderType t) =>
t is ProviderType.Msp or ProviderType.BusinessUnit or ProviderType.Reseller; Prevention
- Add a switch case whenever a new ProviderType is introduced.
- Keep all deployment tiers on the same enum version.
When it happens
Trigger: A new ProviderType enum member was added that ThrowOnInvalidPlanType does not handle, or a corrupt provider record has an integer Type outside the known enum range.
Common situations: Code/schema/enum version drift (server newer than the licensing data, or vice versa); a manually-edited provider Type; an incomplete migration that introduced a new provider type without updating this switch.
Related errors
- Provider name not found.
- Failed to remove organization vault. Please contact support.
- You cannot remove yourself.
- Organization already belongs to a provider.
- The organization is subscribed to Secrets Manager. Please co
AI-assisted analysis of bitwarden/server@e93b962371 (2026-08-13).
Data as JSON: /api/errors/407d34d7cb76e140.
Report an issue: GitHub.