{"record":{"id":"bd01b3765db651b4","repo":"bitwarden/server","slug":"no-ciphers-were-archived-ensure-the-provided-ids","errorCode":null,"errorMessage":"No ciphers were archived. Ensure the provided IDs are correct and you have permission to archive them.","messagePattern":"No ciphers were archived\\. Ensure the provided IDs are correct and you have permission to archive them\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"src/Api/Vault/Controllers/CiphersController.cs","lineNumber":916,"sourceCode":"\n    [HttpPut(\"archive\")]\n    public async Task<ListResponseModel<CipherResponseModel>> PutArchiveMany([FromBody] CipherBulkArchiveRequestModel model)\n    {\n        if (!_globalSettings.SelfHosted && model.Ids.Count() > 500)\n        {\n            throw new BadRequestException(\"You can only archive up to 500 items at a time.\");\n        }\n\n        var userId = _userService.GetProperUserId(User).Value;\n        var user = await _userService.GetUserByPrincipalAsync(User);\n\n        var cipherIdsToArchive = new HashSet<Guid>(model.Ids);\n\n        var archivedCiphers = await _archiveCiphersCommand.ArchiveManyAsync(cipherIdsToArchive, userId);\n\n        if (archivedCiphers.Count == 0)\n        {\n            throw new BadRequestException(\"No ciphers were archived. Ensure the provided IDs are correct and you have permission to archive them.\");\n        }\n\n        var organizationAbilities = await GetOrganizationAbilitiesAsync(archivedCiphers);\n        var responses = archivedCiphers.Select(cipher =>\n            new CipherResponseModel(cipher, user, GetOrganizationAbility(cipher, organizationAbilities), _globalSettings)).ToArray();\n\n        return new ListResponseModel<CipherResponseModel>(responses);\n    }\n\n    [HttpDelete(\"{id}\")]\n    public async Task Delete(Guid id)\n    {\n        var userId = _userService.GetProperUserId(User).Value;\n        var cipher = await GetByIdAsync(id, userId);\n        if (cipher == null)\n        {\n            throw new NotFoundException();\n        }","sourceCodeStart":898,"sourceCodeEnd":934,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/src/Api/Vault/Controllers/CiphersController.cs#L898-L934","documentation":"PUT /ciphers/archive (PutArchiveMany) runs ArchiveManyAsync over the submitted id set; if none of the ids could be archived (all wrong, not owned, lacking permission, or already archived/deleted), the server returns HTTP 400.","triggerScenarios":"A bulk PUT /ciphers/archive where every submitted id is invalid, unowned, uneditable, or already archived.","commonSituations":"Bulk-archiving ids from a stale vault snapshot; archiving org ciphers without edit rights; mixing in already-archived ids.","solutions":["Re-sync the vault and submit only ids you own or can edit that are not already archived.","Filter out already-archived/deleted ids before sending.","For org ciphers, confirm edit permission on the relevant collections."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"async function safeBulkArchive(ids) {\n  const valid = await filterOwnedEditableNotArchived(ids);\n  if (valid.length === 0) throw new Error('No archivable ciphers in the submitted set');\n  return api.put('/ciphers/archive', { ids: valid });\n}","typeGuard":"function hasAnyArchivable(ciphers: { editable?: boolean; deletedDate?: string | null }[]): boolean {\n  return ciphers.some(c => c.editable === true && !c.deletedDate);\n}","tryCatchPattern":null,"preventionTips":["Filter out already-archived/deleted and unowned ids before bulk archive.","Re-sync the vault before bulk operations on stale snapshots.","Confirm edit permission for org ciphers in the set."],"tags":["cipher","archive","permissions","bulk","bad-request"],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}