{"record":{"id":"4dd18bc76f0a8d0a","repo":"bitwarden/server","slug":"you-cannot-create-a-send-that-is-already-expired","errorCode":null,"errorMessage":"You cannot create a Send that is already expired. Adjust the expiration date and try again.","messagePattern":"You cannot create a Send that is already expired\\. Adjust the expiration date and try again\\.","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"src/Api/Tools/Models/Request/SendRequestModel.cs","lineNumber":197,"sourceCode":"        }\n\n        return existingSend;\n    }\n\n    /// <summary>\n    /// Validates that the request is internally consistent for send creation.\n    /// </summary>\n    /// <exception cref=\"BadRequestException\">\n    /// Thrown when the send's expiration date has already expired.\n    /// </exception>\n    public void ValidateCreation()\n    {\n        var now = DateTime.UtcNow;\n        // Add 1 minute for a sane buffer and client clock float\n        var nowPlus1Minute = now.AddMinutes(1);\n        if (ExpirationDate.HasValue && ExpirationDate.Value <= nowPlus1Minute)\n        {\n            throw new BadRequestException(\"You cannot create a Send that is already expired. \" +\n                                          \"Adjust the expiration date and try again.\");\n        }\n\n        ValidateEdit();\n    }\n\n    /// <summary>\n    /// Validates that the request is internally consistent for send administration.\n    /// </summary>\n    /// <exception cref=\"BadRequestException\">\n    /// Thrown when the send's deletion date has already expired or when its\n    /// expiration occurs after its deletion.\n    /// </exception>\n    public void ValidateEdit()\n    {\n        var now = DateTime.UtcNow;\n        // Add 1 minute for a sane buffer and client clock float\n        var nowPlus1Minute = now.AddMinutes(1);","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/src/Api/Tools/Models/Request/SendRequestModel.cs#L179-L215","documentation":"Thrown as BadRequestException (HTTP 400) from SendRequestModel.ValidateCreation() when the request's ExpirationDate is set and is at or before (now + 1 minute). The 1-minute buffer tolerates client/server clock skew. New Sends cannot be created already expired.","triggerScenarios":"POST /sends or POST /sends/file/v2 with ExpirationDate <= DateTime.UtcNow.AddMinutes(1). ValidateCreation() is called at the top of both creation actions.","commonSituations":"Client clock ahead of server so the chosen expiration is already in the past server-side; user picks 'expire now'; timezone mishandling sending local time as UTC; long network delay between picking and submitting.","solutions":["Set ExpirationDate to a value comfortably in the future (e.g. now + 1 hour or more).","Send ExpirationDate in UTC (DateTime.UtcNow) to avoid timezone drift.","Account for the 1-minute skew buffer when computing the value.","If the Send should never expire, omit ExpirationDate (null)."],"exampleFix":"// before\nmodel.ExpirationDate = DateTime.Now.AddSeconds(-5); // local, already past -> 400\n\n// after\nmodel.ExpirationDate = DateTime.UtcNow.AddHours(1); // UTC, future","handlingStrategy":"validation","validationCode":"// Client: validate expiration against the server's skew rule before create\nvar now = DateTime.UtcNow;\nif (model.ExpirationDate.HasValue && model.ExpirationDate.Value <= now.AddMinutes(1)) {\n    ShowUser(\"Expiration date must be in the future.\");\n    return;\n}\nawait client.PostAsync(\"sends\", JsonContent.Create(model));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always compute dates in UTC.","Leave ExpirationDate null when the Send should not expire.","Account for the 1-minute server skew buffer in client validation."],"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"}