{"record":{"id":"6d6dd3e5397029e7","repo":"bitwarden/server","slug":"providers-cannot-manage-organizations-with-the-req","errorCode":null,"errorMessage":"Providers cannot manage organizations with the requested plan type ({requestedType}). Only Teams and Enterprise accounts are allowed.","messagePattern":"Providers cannot manage organizations with the requested plan type \\((.+?)\\)\\. Only Teams and Enterprise accounts are allowed\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs","lineNumber":754,"sourceCode":"    {\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)\n        {\n            var organization = await _organizationRepository.GetByIdAsync(providerOrganization.OrganizationId);\n            if (organization != null && organization.Enabled != enabled)\n            {\n                organization.Enabled = enabled;\n                await _organizationRepository.ReplaceAsync(organization);","sourceCodeStart":736,"sourceCodeEnd":772,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs#L736-L772","documentation":"Thrown by ProviderService.ThrowOnInvalidPlanType for a Reseller provider when the requested PlanType is in _resellerDisallowedOrganizationTypes (the configured set of plans resellers may not manage, generally anything outside Teams/Enterprise). BadRequestException (HTTP 400).","triggerScenarios":"Assigning an organization whose PlanType is in the reseller-disallowed set (e.g. Free, Families, Starter) to a Reseller provider.","commonSituations":"Adding a consumer-tier org to a reseller; a misconfigured _resellerDisallowedOrganizationTypes set that excludes a valid tier after a pricing change.","solutions":["Confirm the org plan is Teams or Enterprise before assigning to a Reseller.","Check the configured _resellerDisallowedOrganizationTypes to ensure intended tiers are allowed.","Upgrade consumer-tier orgs before reseller assignment."],"exampleFix":"// before\nawait providerService.AddOrganizationsToReseller(resellerId, orgIds);\n\n// after\nvar blocked = orgIds\n    .Where(id => resellerDisallowedTypes.Contains(GetOrgPlanType(id)));\nif (blocked.Any())\n{\n    return BadRequest(\"Some orgs are on plans a reseller cannot manage.\");\n}\nawait providerService.AddOrganizationsToReseller(resellerId, orgIds);","handlingStrategy":"validation","validationCode":"if (resellerDisallowedOrganizationTypes.Contains(org.PlanType)) return BadRequest(\"Plan blocked for reseller.\");","typeGuard":"static bool ResellerAllows(PlanType t, ISet<PlanType> blocked) => !blocked.Contains(t);","tryCatchPattern":null,"preventionTips":["Confirm the reseller-disallowed set matches current pricing.","Keep consumer-tier orgs off resellers."],"tags":["provider","reseller","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"}