Skip to content

Conversation

@hbjORbj
Copy link
Contributor

@hbjORbj hbjORbj commented Jan 25, 2026

What does this PR do?

Fixes a 500 error that occurs when rescheduling phone-only bookings.

Request path:

POST /api/book/event
  → RegularBookingService.rescheduleBooking()
    → handleSeats (for seated bookings)
      → combineTwoSeatedBookings() / moveSeatedBookingToNewTimeSlot()
        → sendRescheduledEmailsAndSMS()
          → AttendeeRescheduledEmail.getNodeMailerPayload()
            → generateIcsFile()
              → generateIcsString()
                → ics.createEvent() → Yup ValidationError (500)

The ics library throws a Yup ValidationError when an attendee has a phone number instead of an email. Since Yup ValidationError is not an Error instance, it falls through error handling to a generic 500.

Fix: Catch the ValidationError at the source (generateIcsString.ts) and convert it to ErrorWithCode.BadRequest, returning a proper 400 status code.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
@github-actions
Copy link
Contributor

E2E results are ready!

// The ics library throws Yup ValidationError objects (not Error instances) for invalid data like invalid email formats.
// Convert these to ErrorWithCode.BadRequest so they return 400 instead of falling through to a generic 500.
if (icsEvent.error.name === "ValidationError") {
throw new ErrorWithCode(ErrorCode.BadRequest, icsEvent.error.message);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this propagates all the way to getServerErrorFromUnknown, at which this gets converted into HttpError with status code 400

Comment on lines +177 to +182
// Simulate a Yup ValidationError (which has name: "ValidationError")
const validationError = {
name: "ValidationError",
message: "attendees[0].email must be a valid email",
errors: ["attendees[0].email must be a valid email"],
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed that ics library throws a validation error in this format

@hbjORbj hbjORbj marked this pull request as ready for review January 25, 2026 13:26
@hbjORbj hbjORbj requested a review from a team January 25, 2026 13:26
@graphite-app graphite-app bot added foundation core area: core, team members only labels Jan 25, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@hbjORbj hbjORbj enabled auto-merge (squash) January 25, 2026 13:36
Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! No comments, good to go

@hbjORbj hbjORbj merged commit 6a532c2 into main Jan 25, 2026
48 checks passed
@hbjORbj hbjORbj deleted the devin/1769326283-fix-ics-validation-error-code branch January 25, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants