{"record":{"id":"deb01e37af97be60","repo":"bitwarden/server","slug":"you-cannot-purge-accounts-owned-by-an-organization","errorCode":null,"errorMessage":"You cannot purge accounts owned by an organization. Contact your admin for additional details.","messagePattern":"You cannot purge accounts owned by an organization\\. Contact your admin for additional details\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"src/Api/Vault/Controllers/CiphersController.cs","lineNumber":1302,"sourceCode":"        var user = await _userService.GetUserByPrincipalAsync(User);\n        if (user == null)\n        {\n            throw new UnauthorizedAccessException();\n        }\n\n        if (!await _userService.VerifySecretAsync(user, model.Secret))\n        {\n            ModelState.AddModelError(string.Empty, \"User verification failed.\");\n            await Task.Delay(2000);\n            throw new BadRequestException(ModelState);\n        }\n\n        if (organizationId == null)\n        {\n            // Check if the user is claimed by any organization.\n            if (await _userService.IsClaimedByAnyOrganizationAsync(user.Id))\n            {\n                throw new BadRequestException(new CannotPurgeClaimedAccountError().Message);\n            }\n            await _cipherRepository.DeleteByUserIdAsync(user.Id);\n        }\n        else\n        {\n            if (!await _currentContext.EditAnyCollection(organizationId!.Value))\n            {\n                throw new NotFoundException();\n            }\n            await _cipherService.PurgeAsync(organizationId!.Value);\n        }\n    }\n\n    [HttpPost(\"{id}/attachment/v2\")]\n    public async Task<AttachmentUploadDataResponseModel> PostAttachment(Guid id, [FromBody] AttachmentRequestModel request)\n    {\n        var user = await _userService.GetUserByPrincipalAsync(User);\n        var cipher = request.AdminRequest ?","sourceCodeStart":1284,"sourceCodeEnd":1320,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/src/Api/Vault/Controllers/CiphersController.cs#L1284-L1320","documentation":"Error \"You cannot purge accounts owned by an organization. Contact your admin for additional details.\" thrown in bitwarden/server.","triggerScenarios":"Thrown when a user attempts to purge a vault for an account that is owned/claimed by an organization; purging such accounts is restricted and must go through the organization admin.","commonSituations":"See trigger scenarios.","solutions":["Ask an organization owner to remove your account from the organization before purging the vault.","Contact your admin for assistance releasing the claimed account, then retry the purge."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}