{"record":{"id":"4bf251cdbe4e4142","repo":"bitwarden/server","slug":"resource-not-found-4bf251","errorCode":null,"errorMessage":"Resource not found.","messagePattern":"Resource not found\\.","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"info","filePath":"src/Api/Vault/Controllers/FoldersController.cs","lineNumber":51,"sourceCode":"        IUserService userService,\n        IDeleteManyFoldersCommand deleteManyFoldersCommand,\n        GlobalSettings globalSettings)\n    {\n        _folderRepository = folderRepository;\n        _cipherService = cipherService;\n        _userService = userService;\n        _deleteManyFoldersCommand = deleteManyFoldersCommand;\n        _globalSettings = globalSettings;\n    }\n\n    [HttpGet(\"{id}\")]\n    public async Task<FolderResponseModel> Get(string id)\n    {\n        var userId = _userService.GetProperUserId(User).Value;\n        var folder = await _folderRepository.GetByIdAsync(new Guid(id), userId);\n        if (folder == null)\n        {\n            throw new NotFoundException();\n        }\n\n        return new FolderResponseModel(folder);\n    }\n\n    [HttpGet(\"\")]\n    public async Task<ListResponseModel<FolderResponseModel>> GetAll()\n    {\n        var userId = _userService.GetProperUserId(User).Value;\n        var folders = await _folderRepository.GetManyByUserIdAsync(userId);\n        var responses = folders.Select(f => new FolderResponseModel(f));\n        return new ListResponseModel<FolderResponseModel>(responses);\n    }\n\n    [HttpPost(\"\")]\n    public async Task<FolderResponseModel> Post([FromBody] FolderRequestModel model)\n    {\n        var userId = _userService.GetProperUserId(User).Value;","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/src/Api/Vault/Controllers/FoldersController.cs#L33-L69","documentation":"Thrown by FoldersController.Get (GET /folders/{id}) when _folderRepository.GetByIdAsync(new Guid(id), userId) returns null. The lookup is user-scoped — it filters by the requesting user's ID. Returns 404 if the folder doesn't exist or belongs to a different user.","triggerScenarios":"Folder was deleted before this request; folder belongs to a different user; stale folder ID cached in the client; the ID parameter is not a valid Guid (though that would throw earlier during new Guid(id) parsing).","commonSituations":"Client has stale data showing a folder that was deleted in another session; incorrect or copy-pasted folder ID; user logged into a different account that doesn't have this folder.","solutions":["Refresh the folder list to obtain current folder IDs","Verify the folder ID belongs to the authenticated user","Handle the 404 gracefully in the client by removing the stale folder from local state"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    var folder = await api.GetFolderAsync(folderId);\n}\ncatch (ApiException ex) when (ex.StatusCode == HttpStatusCode.NotFound)\n{\n    // Folder doesn't exist; remove from local cache\n    localFolders.Remove(folderId);\n}","preventionTips":["Refresh the folder list periodically to keep local IDs current","Handle 404 by removing the stale entry from local state","Verify folder IDs match the authenticated user's vault"],"tags":["folders","not-found","crud","user-scoped"],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}