bitwarden/server · error · BadRequestException

You have reached the maximum number of projects ({max}) for

Error message

You have reached the maximum number of projects ({max}) for this plan.

What it means

Thrown by POST /organizations/{organizationId}/projects as Bit.Core.Exceptions.BadRequestException (HTTP 400) when _maxProjectsQuery.GetByOrgIdAsync reports the organization has reached its plan's maximum project count. Unlike the NotFound errors on this controller, this is a real validation/business-rule failure with a descriptive message.

Source

Thrown at src/Api/SecretsManager/Controllers/ProjectsController.cs:90

        return new ListResponseModel<ProjectResponseModel>(responses);
    }

    [HttpPost("organizations/{organizationId}/projects")]
    public async Task<ProjectResponseModel> CreateAsync([FromRoute] Guid organizationId,
        [FromBody] ProjectCreateRequestModel createRequest)
    {
        var project = createRequest.ToProject(organizationId);
        var authorizationResult =
            await _authorizationService.AuthorizeAsync(User, project, ProjectOperations.Create);
        if (!authorizationResult.Succeeded)
        {
            throw new NotFoundException();
        }

        var (max, overMax) = await _maxProjectsQuery.GetByOrgIdAsync(organizationId, 1);
        if (overMax != null && overMax.Value)
        {
            throw new BadRequestException($"You have reached the maximum number of projects ({max}) for this plan.");
        }

        var userId = _userService.GetProperUserId(User).Value;
        var result = await _createProjectCommand.CreateAsync(project, userId, _currentContext.IdentityClientType);

        if (result != null)
        {
            await LogProjectEventAsync(project, EventType.Project_Created);
        }

        // Creating a project means you have read & write permission.
        return new ProjectResponseModel(result, true, true);
    }

    [HttpPut("projects/{id}")]
    public async Task<ProjectResponseModel> UpdateAsync([FromRoute] Guid id,
        [FromBody] ProjectUpdateRequestModel updateRequest)
    {

View on GitHub (pinned to e93b962371)

Solutions

  1. Upgrade the organization's plan to one with a higher (or unlimited) project limit.
  2. Delete unused projects to get back under the cap before creating new ones.
  3. Confirm the maxProjects configuration for the org's plan in the billing/plan settings.
  4. If the limit is wrong, verify the plan assignment and max-projects override on the organization record.

Example fix

// before: keep creating projects past the plan cap
for (var i = 0; i < 100; i++) await CreateProjectAsync(orgId, name$i);

// after: check remaining capacity and upgrade or prune before creating
var (max, over) = await MaxProjectsQuery.GetByOrgIdAsync(orgId);
if (over == true) { await UpgradePlanAsync(orgId); /* or delete old projects */ }
Defensive patterns

Strategy: validation

Validate before calling

// Check remaining project capacity before creating
var (max, over) = await maxProjectsQuery.GetByOrgIdAsync(organizationId, 1);
if (over == true)
{
    // upgrade plan or delete projects to get under the cap
    return;
}
await client.CreateProject(organizationId, createRequest);

Try / catch

try { await client.CreateProject(organizationId, createRequest); }
catch (BadRequestException ex) when (ex.Message.StartsWith("You have reached the maximum number of projects"))
{
    // upgrade the org plan or prune unused projects, then retry
}

Prevention

When it happens

Trigger: The organization's current project count already equals or exceeds the plan's maxProjects limit, and another create is attempted. overMax is set by the plan-capacity query after authorization has already passed.

Common situations: Free/Starter plan hitting its project ceiling; seeding scripts that create more projects than the plan allows; plan downgrade left the org over its new, lower limit.

Related errors


AI-assisted analysis of bitwarden/server@e93b962371 (2026-08-13). Data as JSON: /api/errors/5baf2561fd2bccf8. Report an issue: GitHub.