{"record":{"id":"c33f10f12ea79ea5","repo":"bitwarden/server","slug":"noseatsavailable","errorCode":null,"errorMessage":"NoSeatsAvailable","messagePattern":"NoSeatsAvailable","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"bitwarden_license/src/Sso/Controllers/AccountController.cs","lineNumber":655,"sourceCode":"                try\n                {\n                    if (_globalSettings.SelfHosted)\n                    {\n                        throw new Exception(\"Cannot autoscale on self-hosted instance.\");\n                    }\n\n                    await _organizationService.AutoAddSeatsAsync(organization, 1);\n                }\n                catch (Exception e)\n                {\n                    if (organization.Seats.Value != initialSeatCount)\n                    {\n                        await _organizationService.AdjustSeatsAsync(organization.Id,\n                            initialSeatCount - organization.Seats.Value);\n                    }\n\n                    _logger.LogInformation(e, \"SSO auto provisioning failed\");\n                    throw new Exception(_i18nService.T(\"NoSeatsAvailable\", organization.DisplayName()));\n                }\n            }\n        }\n\n        // If the email domain is verified, we can mark the email as verified\n        if (string.IsNullOrWhiteSpace(email))\n        {\n            throw new Exception(_i18nService.T(\"CannotFindEmailClaim\"));\n        }\n\n        var emailVerified = false;\n        var emailDomain = CoreHelpers.GetEmailDomain(email);\n        if (!string.IsNullOrWhiteSpace(emailDomain))\n        {\n            var organizationDomain =\n                await _organizationDomainRepository.GetDomainByOrgIdAndDomainNameAsync(organization.Id, emailDomain);\n            emailVerified = organizationDomain?.VerifiedDate.HasValue ?? false;\n        }","sourceCodeStart":637,"sourceCodeEnd":673,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/bitwarden_license/src/Sso/Controllers/AccountController.cs#L637-L673","documentation":"Thrown in AccountController.CreateUserAndOrgUserConditionallyAsync (line 655) when JIT provisioning needs a new seat (availableSeats < 1 and possibleOrgUser is null) but AutoAddSeatsAsync fails. The inner catch reverts any partial seat adjustment and re-throws with the organization's display name. On self-hosted instances, autoscaling is disabled entirely and always throws.","triggerScenarios":"A new user is being JIT-provisioned, the organization has a seat limit, all seats are occupied, and the server cannot auto-add seats (self-hosted, or cloud billing/plan limit reached).","commonSituations":"Self-hosted instance where seat autoscaling is not supported; cloud org at its plan's maximum seat count; billing failure (payment method expired, subscription lapsed); plan does not support seat expansion.","solutions":["On self-hosted: manually increase the organization's seat count via the admin portal or database before the user retries SSO.","On cloud: upgrade the org plan or purchase additional seats, then retry.","Verify the org's billing is current and the payment method is valid.","Check server logs for the inner exception from AutoAddSeatsAsync for billing API errors."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before JIT provisioning, check available seats\nif (possibleOrgUser == null && organization.Seats.HasValue)\n{\n    var occupied = await _organizationRepository.GetOccupiedSeatCountByOrganizationIdAsync(organization.Id);\n    if (organization.Seats.Value - occupied.Total < 1 && _globalSettings.SelfHosted)\n        return BadRequest(\"No seats available. An admin must increase the seat count.\");\n}","typeGuard":null,"tryCatchPattern":"try { await CreateUserAndOrgUserConditionallyAsync(...); }\ncatch (Exception ex) when (ex.Message.Contains(\"NoSeatsAvailable\"))\n{ /* notify admin to purchase/increase seats; retry after */ }","preventionTips":["On self-hosted: pre-allocate enough seats for expected JIT-provisioned users.","On cloud: keep billing current and auto-scale enabled.","Monitor seat utilization and alert admins before capacity is reached."],"tags":["sso","authentication","billing","seats","provisioning","jit","self-hosted"],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}