{"record":{"id":"38c526b685293bb9","repo":"bitwarden/server","slug":"you-cannot-have-a-send-with-an-expiration-date-in","errorCode":null,"errorMessage":"You cannot have a Send with an expiration date in the past. Adjust the expiration date and try again.","messagePattern":"You cannot have a Send with an expiration date in the past\\. Adjust the expiration date and try again\\.","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"src/Api/Tools/Models/Request/SendRequestModel.cs","lineNumber":236,"sourceCode":"            if (DeletionDate.Value <= nowPlus1Minute)\n            {\n                throw new BadRequestException(\"You cannot have a Send with a deletion date in the past. \" +\n                                              \"Adjust the deletion date and try again.\");\n            }\n\n            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;","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/src/Api/Tools/Models/Request/SendRequestModel.cs#L218-L254","documentation":"Thrown as BadRequestException (HTTP 400) from SendRequestModel.ValidateEdit() when ExpirationDate is set and is at or before (now + 1 minute). During edits this can fire even though creation succeeded — e.g. editing an old Send whose expiration has since passed. Mirrors [475] but in the edit-validation path.","triggerScenarios":"PUT /sends/{id} (or create) where ExpirationDate is non-null and <= DateTime.UtcNow.AddMinutes(1). Common when editing a Send that is about to expire or already expired but not yet deleted.","commonSituations":"Editing an aging Send whose expiration has elapsed; client clock skew; timezone bug; re-saving a Send near its expiration boundary.","solutions":["Set ExpirationDate to a future value or remove it (null) to disable expiration.","Send ExpirationDate in UTC and respect the 1-minute buffer.","If the Send is already expired, create a new one rather than editing.","Refresh the expiration field in the edit UI to a future time before saving."],"exampleFix":"// before: editing an expired send\nPUT /sends/{id}  body: { ..., \"expirationDate\": \"2020-01-01T00:00:00Z\" } -> 400\n\n// after\nPUT /sends/{id}  body: { ..., \"expirationDate\": \"2026-12-31T00:00:00Z\" }","handlingStrategy":"validation","validationCode":"// Client: validate expiration on edit\nvar now = DateTime.UtcNow;\nif (model.ExpirationDate.HasValue && model.ExpirationDate.Value <= now.AddMinutes(1)) {\n    // either push it forward or clear it\n    model.ExpirationDate = null;\n}\nawait client.PutAsync($\"sends/{id}\", JsonContent.Create(model));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When editing an aging Send, refresh ExpirationDate to a future value or clear it.","Compute expiration in UTC with the 1-minute buffer.","Create a new Send rather than editing one already expired."],"tags":["send","http-400","validation","datetime","expiration","bitwarden-server"],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}