{"record":{"id":"801e020ef78add62","repo":"bitwarden/server","slug":"business-unit-providers-cannot-manage-organization","errorCode":null,"errorMessage":"Business Unit Providers cannot manage organizations with the plan type {requestedType}. Only Enterprise (Monthly) and Enterprise (Annually) are allowed.","messagePattern":"Business Unit Providers cannot manage organizations with the plan type (.+?)\\. Only Enterprise \\(Monthly\\) and Enterprise \\(Annually\\) are allowed\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs","lineNumber":748,"sourceCode":"        var confirmedOwners = providerAdmins.Where(o => o.Status == ProviderUserStatusType.Confirmed);\n        var confirmedOwnersIds = confirmedOwners.Select(u => u.Id);\n        return confirmedOwnersIds.Except(providerUserIds).Any();\n    }\n\n    private void ThrowOnInvalidPlanType(ProviderType providerType, PlanType requestedType)\n    {\n        switch (providerType)\n        {\n            case ProviderType.Msp:\n                if (requestedType is not (PlanType.TeamsMonthly or PlanType.EnterpriseMonthly))\n                {\n                    throw new BadRequestException($\"Managed Service Providers cannot manage organizations with the plan type {requestedType}. Only Teams (Monthly) and Enterprise (Monthly) are allowed.\");\n                }\n                break;\n            case ProviderType.BusinessUnit:\n                if (requestedType is not (PlanType.EnterpriseMonthly or PlanType.EnterpriseAnnually))\n                {\n                    throw new BadRequestException($\"Business Unit Providers cannot manage organizations with the plan type {requestedType}. Only Enterprise (Monthly) and Enterprise (Annually) are allowed.\");\n                }\n                break;\n            case ProviderType.Reseller:\n                if (_resellerDisallowedOrganizationTypes.Contains(requestedType))\n                {\n                    throw new BadRequestException($\"Providers cannot manage organizations with the requested plan type ({requestedType}). Only Teams and Enterprise accounts are allowed.\");\n                }\n                break;\n            default:\n                throw new BadRequestException($\"Unsupported provider type {providerType}.\");\n        }\n    }\n\n    private async Task UpdateClientOrganizationsEnabledStatusAsync(Guid providerId, bool enabled)\n    {\n        var providerOrganizations = await _providerOrganizationRepository.GetManyDetailsByProviderAsync(providerId);\n\n        foreach (var providerOrganization in providerOrganizations)","sourceCodeStart":730,"sourceCodeEnd":766,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs#L730-L766","documentation":"Thrown by ProviderService.ThrowOnInvalidPlanType for a BusinessUnit provider when the requested PlanType is not EnterpriseMonthly or EnterpriseAnnually. Business Unit providers can only manage Enterprise-tier organizations. BadRequestException (HTTP 400).","triggerScenarios":"Assigning a non-Enterprise organization (Free, Families, Teams, Starter) to a BusinessUnit provider.","commonSituations":"Trying to put a Teams-tier org under a business-unit provider; converting a non-enterprise org through the business-unit flow.","solutions":["Upgrade the organization to an Enterprise plan (monthly or annual) before assigning to a BusinessUnit provider.","For non-Enterprise orgs, use the appropriate MSP or Reseller flow instead.","Validate PlanType is in the Enterprise set before calling AddOrganization."],"exampleFix":"// before\nawait providerService.AddOrganization(buProviderId, orgId, key);\n\n// after\nvar allowed = new[] { PlanType.EnterpriseMonthly, PlanType.EnterpriseAnnually };\nif (!allowed.Contains(org.PlanType))\n{\n    return BadRequest(\"Org must be Enterprise (Monthly or Annual) for a Business Unit provider.\");\n}\nawait providerService.AddOrganization(buProviderId, orgId, key);","handlingStrategy":"validation","validationCode":"var allowed = new[] { PlanType.EnterpriseMonthly, PlanType.EnterpriseAnnually };\nif (!allowed.Contains(org.PlanType)) return BadRequest(\"Enterprise only.\");","typeGuard":"static bool BusinessUnitAllows(PlanType t) => t is PlanType.EnterpriseMonthly or PlanType.EnterpriseAnnually;","tryCatchPattern":null,"preventionTips":["Upgrade orgs to Enterprise before BusinessUnit provider assignment.","Branch plan validation by provider type."],"tags":["provider","business-unit","plan-type","billing","bad-request"],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}