{"record":{"id":"ad667795f79d576f","repo":"bitwarden/server","slug":"you-cannot-have-a-send-with-an-expiration-date-gre","errorCode":null,"errorMessage":"You cannot have a Send with an expiration date greater than the deletion date. Adjust the expiration date and try again.","messagePattern":"You cannot have a Send with an expiration date greater than the deletion date\\. Adjust the expiration date and try again\\.","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"src/Api/Tools/Models/Request/SendRequestModel.cs","lineNumber":242,"sourceCode":"            if (DeletionDate.Value > now.AddDays(31))\n            {\n                throw new BadRequestException(\"You cannot have a Send with a deletion date that far \" +\n                                              \"into the future. Adjust the Deletion Date to a value less than 31 days from now \" +\n                                              \"and try again.\");\n            }\n        }\n\n        if (ExpirationDate.HasValue)\n        {\n            if (ExpirationDate.Value <= nowPlus1Minute)\n            {\n                throw new BadRequestException(\"You cannot have a Send with an expiration date in the past. \" +\n                                              \"Adjust the expiration date and try again.\");\n            }\n\n            if (DeletionDate.HasValue && ExpirationDate.Value > DeletionDate.Value)\n            {\n                throw new BadRequestException(\n                    \"You cannot have a Send with an expiration date greater than the deletion date. \" +\n                    \"Adjust the expiration date and try again.\");\n            }\n        }\n    }\n\n    private Send ToSendBase(Send existingSend, ISendAuthorizationService authorizationService)\n    {\n        existingSend.Key = Key;\n        existingSend.ExpirationDate = ExpirationDate;\n        existingSend.DeletionDate = DeletionDate!.Value;\n        existingSend.MaxAccessCount = MaxAccessCount;\n        existingSend.Disabled = Disabled.GetValueOrDefault();\n        existingSend.HideEmail = HideEmail.GetValueOrDefault();\n\n        if (existingSend.AuthType == Core.Tools.Enums.AuthType.Password &&\n            AuthType == Core.Tools.Enums.AuthType.Password)\n        {","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/src/Api/Tools/Models/Request/SendRequestModel.cs#L224-L260","documentation":"Thrown as BadRequestException (HTTP 400) from SendRequestModel.ValidateEdit() when both ExpirationDate and DeletionDate are set and ExpirationDate > DeletionDate. Logically a Send cannot expire after it is deleted; the server enforces expiration <= deletion.","triggerScenarios":"Any create/edit Send request where ExpirationDate.HasValue && DeletionDate.HasValue && ExpirationDate.Value > DeletionDate.Value.","commonSituations":"User sets a long expiration but a short deletion; client computes the two independently without cross-checking; editing the deletion date down without adjusting expiration; timezone/unit mismatch between the two fields.","solutions":["Ensure ExpirationDate <= DeletionDate (or leave ExpirationDate null).","In the client, derive expiration from deletion or clamp expiration to deletion when the user lowers deletion.","Validate the ordering before submitting the request.","If unsure, omit ExpirationDate so the Send lives until its deletion date."],"exampleFix":"// before\nmodel.DeletionDate = DateTime.UtcNow.AddDays(7);\nmodel.ExpirationDate = DateTime.UtcNow.AddDays(10); // > deletion -> 400\n\n// after\nmodel.DeletionDate = DateTime.UtcNow.AddDays(10);\nmodel.ExpirationDate = DateTime.UtcNow.AddDays(7); // <= deletion","handlingStrategy":"validation","validationCode":"// Client: enforce expiration <= deletion\nif (model.ExpirationDate.HasValue && model.DeletionDate.HasValue\n    && model.ExpirationDate.Value > model.DeletionDate.Value) {\n    ShowUser(\"Expiration date cannot be after the deletion date.\");\n    return;\n}\nawait client.PostAsync(\"sends\", JsonContent.Create(model));","typeGuard":"static bool DatesAreConsistent(SendRequestModel m) =>\n    !(m.ExpirationDate.HasValue && m.DeletionDate.HasValue\n      && m.ExpirationDate.Value > m.DeletionDate.Value);","tryCatchPattern":null,"preventionTips":["When the user lowers DeletionDate, clamp ExpirationDate down too.","Derive ExpirationDate from DeletionDate in the UI where possible.","Add a client-side invariant: expiration <= deletion (or expiration null)."],"tags":["send","http-400","validation","datetime","expiration","deletion-date","bitwarden-server"],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}