{"record":{"id":"80c29f3bbac8bcfc","repo":"bitwarden/server","slug":"max-file-size-is-cipherservice-max-file-size-read","errorCode":null,"errorMessage":"Max file size is {CipherService.MAX_FILE_SIZE_READABLE}.","messagePattern":"Max file size is (.+?)\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"src/Api/Vault/Controllers/CiphersController.cs","lineNumber":1332,"sourceCode":"    }\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 ?\n            await _cipherRepository.GetOrganizationDetailsByIdAsync(id) :\n            await GetByIdAsync(id, user.Id);\n\n        if (cipher == null || (request.AdminRequest && (!cipher.OrganizationId.HasValue ||\n            !await CanEditCipherAsAdminAsync(cipher.OrganizationId.Value, new[] { cipher.Id }))))\n        {\n            throw new NotFoundException();\n        }\n\n        if (request.FileSize > CipherService.MAX_FILE_SIZE)\n        {\n            throw new BadRequestException($\"Max file size is {CipherService.MAX_FILE_SIZE_READABLE}.\");\n        }\n\n        var (attachmentId, uploadUrl) = await _cipherService.CreateAttachmentForDelayedUploadAsync(cipher,\n            request.Key, request.FileName, request.FileSize, request.AdminRequest, user.Id, request.LastKnownRevisionDate);\n\n        var cipherDetails = (CipherDetails)cipher;\n        return new AttachmentUploadDataResponseModel\n        {\n            AttachmentId = attachmentId,\n            Url = uploadUrl,\n            FileUploadType = _attachmentStorageService.FileUploadType,\n            CipherResponse = request.AdminRequest ? null : new CipherResponseModel(\n                cipherDetails,\n                user,\n                await GetOrganizationAbilityAsync(cipherDetails),\n                _globalSettings),\n            CipherMiniResponse = request.AdminRequest ? new CipherMiniResponseModel(cipher, _globalSettings, cipher.OrganizationUseTotp) : null,\n        };","sourceCodeStart":1314,"sourceCodeEnd":1350,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/src/Api/Vault/Controllers/CiphersController.cs#L1314-L1350","documentation":"Error \"Max file size is {CipherService.MAX_FILE_SIZE_READABLE}.\" thrown in bitwarden/server.","triggerScenarios":"Thrown when an uploaded cipher attachment exceeds the maximum allowed file size defined by CipherService.MAX_FILE_SIZE.","commonSituations":"See trigger scenarios.","solutions":["Reduce the attachment to below the maximum allowed file size and upload again.","Compress or split the file before attaching it to the cipher.","Store very large files outside Bitwarden (e.g. Send or external storage) and keep a reference in the cipher instead."],"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"}