bitwarden/server · error · BadRequestException

You cannot have a Send with a deletion date that far into th

Error message

You cannot have a Send with a deletion date that far into the future. Adjust the Deletion Date to a value less than 31 days from now and try again.

What it means

Thrown as BadRequestException (HTTP 400) from SendRequestModel.ValidateEdit() when DeletionDate is set and is more than 31 days in the future. The server enforces a hard 31-day maximum lifetime on Sends; a background job deletes them after this window.

Source

Thrown at src/Api/Tools/Models/Request/SendRequestModel.cs:226

    /// Thrown when the send's deletion date has already expired or when its
    /// expiration occurs after its deletion.
    /// </exception>
    public void ValidateEdit()
    {
        var now = DateTime.UtcNow;
        // Add 1 minute for a sane buffer and client clock float
        var nowPlus1Minute = now.AddMinutes(1);
        if (DeletionDate.HasValue)
        {
            if (DeletionDate.Value <= nowPlus1Minute)
            {
                throw new BadRequestException("You cannot have a Send with a deletion date in the past. " +
                                              "Adjust the deletion date and try again.");
            }

            if (DeletionDate.Value > now.AddDays(31))
            {
                throw new BadRequestException("You cannot have a Send with a deletion date that far " +
                                              "into the future. Adjust the Deletion Date to a value less than 31 days from now " +
                                              "and try again.");
            }
        }

        if (ExpirationDate.HasValue)
        {
            if (ExpirationDate.Value <= nowPlus1Minute)
            {
                throw new BadRequestException("You cannot have a Send with an expiration date in the past. " +
                                              "Adjust the expiration date and try again.");
            }

            if (DeletionDate.HasValue && ExpirationDate.Value > DeletionDate.Value)
            {
                throw new BadRequestException(
                    "You cannot have a Send with an expiration date greater than the deletion date. " +
                    "Adjust the expiration date and try again.");

View on GitHub (pinned to e93b962371)

Solutions

  1. Set DeletionDate to 31 days or less from now.
  2. Cap the client's deletion-date picker maximum at now + 31 days.
  3. Validate the chosen date against the 31-day ceiling before submission.
  4. Check for year/timezone input mistakes producing a distant date.

Example fix

// before
model.DeletionDate = DateTime.UtcNow.AddYears(1); // > 31 days -> 400

// after
model.DeletionDate = DateTime.UtcNow.AddDays(30); // within 31 days
Defensive patterns

Strategy: validation

Validate before calling

// Client: enforce the 31-day ceiling
var now = DateTime.UtcNow;
if (model.DeletionDate.HasValue && model.DeletionDate.Value > now.AddDays(31)) {
    ShowUser("Deletion date cannot be more than 31 days away.");
    return;
}
await client.PostAsync("sends", JsonContent.Create(model));

Prevention

When it happens

Trigger: Any create/edit Send request where DeletionDate > DateTime.UtcNow.AddDays(31).

Common situations: User picks a far-future deletion (e.g. 1 year); client defaults to a very long retention; timezone or year-field input error (e.g. 2099); copy-paste of a long duration.

Related errors


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