{"record":{"id":"5baf2561fd2bccf8","repo":"bitwarden/server","slug":"you-have-reached-the-maximum-number-of-projects","errorCode":null,"errorMessage":"You have reached the maximum number of projects ({max}) for this plan.","messagePattern":"You have reached the maximum number of projects \\((.+?)\\) for this plan\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"src/Api/SecretsManager/Controllers/ProjectsController.cs","lineNumber":90,"sourceCode":"        return new ListResponseModel<ProjectResponseModel>(responses);\n    }\n\n    [HttpPost(\"organizations/{organizationId}/projects\")]\n    public async Task<ProjectResponseModel> CreateAsync([FromRoute] Guid organizationId,\n        [FromBody] ProjectCreateRequestModel createRequest)\n    {\n        var project = createRequest.ToProject(organizationId);\n        var authorizationResult =\n            await _authorizationService.AuthorizeAsync(User, project, ProjectOperations.Create);\n        if (!authorizationResult.Succeeded)\n        {\n            throw new NotFoundException();\n        }\n\n        var (max, overMax) = await _maxProjectsQuery.GetByOrgIdAsync(organizationId, 1);\n        if (overMax != null && overMax.Value)\n        {\n            throw new BadRequestException($\"You have reached the maximum number of projects ({max}) for this plan.\");\n        }\n\n        var userId = _userService.GetProperUserId(User).Value;\n        var result = await _createProjectCommand.CreateAsync(project, userId, _currentContext.IdentityClientType);\n\n        if (result != null)\n        {\n            await LogProjectEventAsync(project, EventType.Project_Created);\n        }\n\n        // Creating a project means you have read & write permission.\n        return new ProjectResponseModel(result, true, true);\n    }\n\n    [HttpPut(\"projects/{id}\")]\n    public async Task<ProjectResponseModel> UpdateAsync([FromRoute] Guid id,\n        [FromBody] ProjectUpdateRequestModel updateRequest)\n    {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/src/Api/SecretsManager/Controllers/ProjectsController.cs#L72-L108","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Upgrade the organization's plan to one with a higher (or unlimited) project limit.","Delete unused projects to get back under the cap before creating new ones.","Confirm the maxProjects configuration for the org's plan in the billing/plan settings.","If the limit is wrong, verify the plan assignment and max-projects override on the organization record."],"exampleFix":"// before: keep creating projects past the plan cap\nfor (var i = 0; i < 100; i++) await CreateProjectAsync(orgId, name$i);\n\n// after: check remaining capacity and upgrade or prune before creating\nvar (max, over) = await MaxProjectsQuery.GetByOrgIdAsync(orgId);\nif (over == true) { await UpgradePlanAsync(orgId); /* or delete old projects */ }","handlingStrategy":"validation","validationCode":"// Check remaining project capacity before creating\nvar (max, over) = await maxProjectsQuery.GetByOrgIdAsync(organizationId, 1);\nif (over == true)\n{\n    // upgrade plan or delete projects to get under the cap\n    return;\n}\nawait client.CreateProject(organizationId, createRequest);","typeGuard":null,"tryCatchPattern":"try { await client.CreateProject(organizationId, createRequest); }\ncatch (BadRequestException ex) when (ex.Message.StartsWith(\"You have reached the maximum number of projects\"))\n{\n    // upgrade the org plan or prune unused projects, then retry\n}","preventionTips":["Query maxProjects capacity before bulk-creating projects.","Prune unused projects to stay under the plan cap.","Upgrade the plan if the org legitimately needs more projects.","After a plan downgrade, proactively trim projects to the new limit."],"tags":["secrets-manager","plan-limit","project","http-400","bad-request"],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}