Finagle's Law was an adage that was commonly stated as, Anything that can go wrong, will – at the worst possible moment.
In 2267, aboard the USS Enterprise, Captain James T. Kirk was ordered to alter his course from Vulcan to Altair VI by Admiral Komack so that the Federation starship would arrive at the inauguration ceremony of the Altairian president in time. After ordering the course change, Kirk told Commander Spock, who had a biological need to visit his homeworld, "Sailor's luck, Spock. Or, as one of Finagle's Laws puts it, 'Any home port the ship makes will be somebody's else, not mine.' " (TOS: "Amok Time")