{"record":{"id":"d57cb271a2356a33","repo":"bitwarden/server","slug":"the-organization-is-subscribed-to-secrets-manager","errorCode":null,"errorMessage":"The organization is subscribed to Secrets Manager. Please contact Customer Support to manage the subscription.","messagePattern":"The organization is subscribed to Secrets Manager\\. Please contact Customer Support to manage the subscription\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs","lineNumber":449,"sourceCode":"    }\n\n    public async Task AddOrganization(Guid providerId, Guid organizationId, string key)\n    {\n        var po = await _providerOrganizationRepository.GetByOrganizationId(organizationId);\n        if (po != null)\n        {\n            throw new BadRequestException(\"Organization already belongs to a provider.\");\n        }\n\n        var organization = await _organizationRepository.GetByIdAsync(organizationId);\n\n        var provider = await _providerRepository.GetByIdAsync(providerId);\n\n        ThrowOnInvalidPlanType(provider.Type, organization.PlanType);\n\n        if (organization.UseSecretsManager)\n        {\n            throw new BadRequestException(\n                \"The organization is subscribed to Secrets Manager. Please contact Customer Support to manage the subscription.\");\n        }\n\n        var providerOrganization = new ProviderOrganization\n        {\n            ProviderId = providerId,\n            OrganizationId = organizationId,\n            Key = key,\n        };\n\n        await ApplyProviderPriceRateAsync(organization, provider);\n        await _providerOrganizationRepository.CreateAsync(providerOrganization);\n\n        organization.BillingEmail = provider.BillingEmail;\n        await _organizationRepository.ReplaceAsync(organization);\n\n        if (!string.IsNullOrEmpty(organization.GatewayCustomerId))\n        {","sourceCodeStart":431,"sourceCodeEnd":467,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/bitwarden_license/src/Commercial.Core/AdminConsole/Services/ProviderService.cs#L431-L467","documentation":"Thrown by ProviderService.AddOrganization after the org is confirmed unlinked and plan types are validated, when organization.UseSecretsManager is true. Provider-managed orgs that already have a Secrets Manager subscription cannot be added directly; support must handle the subscription migration. BadRequestException (HTTP 400).","triggerScenarios":"Adding an organization that has UseSecretsManager enabled (active Secrets Manager add-on) to a provider via AddOrganization.","commonSituations":"An enterprise org that purchased Secrets Manager standalone is later moved under a provider; the SM subscription must be reconciled by support before the provider link is created.","solutions":["Contact Customer Support to migrate/cancel the Secrets Manager subscription before provider-adding the org.","If programmatic, check organization.UseSecretsManager first and route to a support workflow instead of AddOrganization.","Confirm with billing whether the provider plan includes SM before attempting the add."],"exampleFix":"// before\nawait providerService.AddOrganization(providerId, orgId, key);\n\n// after\nif (organization.UseSecretsManager)\n{\n    return RedirectToSupport(\"Secrets Manager subscription migration required.\");\n}\nawait providerService.AddOrganization(providerId, orgId, key);","handlingStrategy":"validation","validationCode":"if (organization.UseSecretsManager) { /* route to support, do not call AddOrganization */ }","typeGuard":"static bool HasSecretsManager(Organization org) => org.UseSecretsManager;","tryCatchPattern":null,"preventionTips":["Pre-screen org.UseSecretsManager before provider-add.","Coordinate SM subscription migration with support up front."],"tags":["provider","secrets-manager","billing","bad-request"],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}