bitwarden/server · info · NotFoundException

Resource not found.

Error message

Resource not found.

What it means

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.

Source

Thrown at src/Api/Vault/Controllers/FoldersController.cs:51

        IUserService userService,
        IDeleteManyFoldersCommand deleteManyFoldersCommand,
        GlobalSettings globalSettings)
    {
        _folderRepository = folderRepository;
        _cipherService = cipherService;
        _userService = userService;
        _deleteManyFoldersCommand = deleteManyFoldersCommand;
        _globalSettings = globalSettings;
    }

    [HttpGet("{id}")]
    public async Task<FolderResponseModel> Get(string id)
    {
        var userId = _userService.GetProperUserId(User).Value;
        var folder = await _folderRepository.GetByIdAsync(new Guid(id), userId);
        if (folder == null)
        {
            throw new NotFoundException();
        }

        return new FolderResponseModel(folder);
    }

    [HttpGet("")]
    public async Task<ListResponseModel<FolderResponseModel>> GetAll()
    {
        var userId = _userService.GetProperUserId(User).Value;
        var folders = await _folderRepository.GetManyByUserIdAsync(userId);
        var responses = folders.Select(f => new FolderResponseModel(f));
        return new ListResponseModel<FolderResponseModel>(responses);
    }

    [HttpPost("")]
    public async Task<FolderResponseModel> Post([FromBody] FolderRequestModel model)
    {
        var userId = _userService.GetProperUserId(User).Value;

View on GitHub (pinned to e93b962371)

Solutions

  1. Refresh the folder list to obtain current folder IDs
  2. Verify the folder ID belongs to the authenticated user
  3. Handle the 404 gracefully in the client by removing the stale folder from local state
Defensive patterns

Strategy: try-catch

Try / catch

try
{
    var folder = await api.GetFolderAsync(folderId);
}
catch (ApiException ex) when (ex.StatusCode == HttpStatusCode.NotFound)
{
    // Folder doesn't exist; remove from local cache
    localFolders.Remove(folderId);
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


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