Episode Star Trek: The Next Generation S5E18 · 2368

Cause and Effect

Cause and Effect
Image: TMDB

The Enterprise is trapped in a time loop that always ends in destruction.

The Enterprise is caught in a time loop. Each repetition ends with a collision with another ship and the destruction of the Enterprise, after which the same events begin again. The crew slowly notices déjà vu and hears echoes of earlier loops.
Realising what is happening, Data and Geordi plan to send a message to the next loop. Data subconsciously plants a clue built around the number three, the pips on Riker's collar, and in the next loop he follows Riker's suggestion, saving the ship. The other vessel is the USS Bozeman, commanded by Captain Morgan Bateson, which has been trapped in the loop for about ninety years.