There's been some bad luck on nonstop United flights to Rome out of SFO this week, with two now having had to divert after takeoff for different reasons.

First, on Tuesday, Flight 507 had to divert to Sacramento due to a mechanical issue. As NBC Bay Area reported, a passenger on that flight said that the pilot informed passengers that one of the engines was overheating, and it had to be shut down so they could make an emergency landing.

The plane landed safely and was being inspected at Sacramento International Airport.

Passengers on that Boeing 777 jet were reportedly bussed back to SFO, and were rebooked on other flights — United offers several routes to Rome per day out of SFO, but only one non-stop flight in the summer that flies out at 4:30 pm.

That same flight number, Flight 507, presumably using a different jet, had trouble of a different sort on Wednesday. As NBC Bay Area reports, that plane made an emergency landing in Edmonton, Canada, due to a passenger with a medical issue. But then instead of continuing on to Rome, the plane returned to SFO, and those passengers were expected to leave again for Rome on Thursday.

It's possible that some of the passengers who were diverted to Sacramento on Tuesday were rebooked on this flight, and had their trip derailed a second day in a row.

These mishaps follow months of mechanical issues on Boeing jets belonging to United and other airlines, some of which have led to unexpected diversions.

In March, a United flight bound for Paris out of SFO experienced engine problems and had to divert to Denver. One day later, a United flight bound for SFO out of Frankfurt had to divert and return to Frankfurt due to an overflowing toilet situation.

Earlier in March, a Japan-bound United flight out of SFO lost a tire during takeoff and had to make an emergency diversion to LAX. And, in February, a Boston-bound United flight had to divert to Denver after a piece of its wing-flap tore off sometime after takeoff, possibly due to an earlier bird-strike incident.

Previously: United Airlines Jet Clips Wing of Another United Jet at SFO