bitwarden/server · error · BadRequestException

Max file size is {CipherService.MAX_FILE_SIZE_READABLE}.

Error message

Max file size is {CipherService.MAX_FILE_SIZE_READABLE}.

What it means

Error "Max file size is {CipherService.MAX_FILE_SIZE_READABLE}." thrown in bitwarden/server.

Source

Thrown at src/Api/Vault/Controllers/CiphersController.cs:1332

    }

    [HttpPost("{id}/attachment/v2")]
    public async Task<AttachmentUploadDataResponseModel> PostAttachment(Guid id, [FromBody] AttachmentRequestModel request)
    {
        var user = await _userService.GetUserByPrincipalAsync(User);
        var cipher = request.AdminRequest ?
            await _cipherRepository.GetOrganizationDetailsByIdAsync(id) :
            await GetByIdAsync(id, user.Id);

        if (cipher == null || (request.AdminRequest && (!cipher.OrganizationId.HasValue ||
            !await CanEditCipherAsAdminAsync(cipher.OrganizationId.Value, new[] { cipher.Id }))))
        {
            throw new NotFoundException();
        }

        if (request.FileSize > CipherService.MAX_FILE_SIZE)
        {
            throw new BadRequestException($"Max file size is {CipherService.MAX_FILE_SIZE_READABLE}.");
        }

        var (attachmentId, uploadUrl) = await _cipherService.CreateAttachmentForDelayedUploadAsync(cipher,
            request.Key, request.FileName, request.FileSize, request.AdminRequest, user.Id, request.LastKnownRevisionDate);

        var cipherDetails = (CipherDetails)cipher;
        return new AttachmentUploadDataResponseModel
        {
            AttachmentId = attachmentId,
            Url = uploadUrl,
            FileUploadType = _attachmentStorageService.FileUploadType,
            CipherResponse = request.AdminRequest ? null : new CipherResponseModel(
                cipherDetails,
                user,
                await GetOrganizationAbilityAsync(cipherDetails),
                _globalSettings),
            CipherMiniResponse = request.AdminRequest ? new CipherMiniResponseModel(cipher, _globalSettings, cipher.OrganizationUseTotp) : null,
        };

View on GitHub (pinned to e93b962371)

Solutions

  1. Reduce the attachment to below the maximum allowed file size and upload again.
  2. Compress or split the file before attaching it to the cipher.
  3. Store very large files outside Bitwarden (e.g. Send or external storage) and keep a reference in the cipher instead.

When it happens

Trigger: Thrown when an uploaded cipher attachment exceeds the maximum allowed file size defined by CipherService.MAX_FILE_SIZE.

Common situations: See trigger scenarios.


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