The attack was no mistake. The Israelis did it to cloak their operations in the war from their ‘ally’, the U.S.
It was a ruthless decision made by a country that found itself in extremis and decided to act in what it perceived to be its critical tactical interests.
I hope we don’t have this problem again. The U.S. military has enough experience (Pueblo, Liberty) to know they shouldn’t have intel ships operating alone without sufficient covering force.
I'm not sure that you can say that Israel was an 'ally' of the US during that period in history. Most of the weapons systems in the IDF inventory were either French (aircraft) or British (tanks). The American-built equipment that they had was largely purchased on the world arms market or smuggled. Also, Eisenhower had forced the Israelis out of Suez in '56 when he yanked support from the French/British component of the operation to regain the Suez Canal.
Putting it all together, Israel might have had a motive to 'blind' US intelligence to their strategic intentions. I go back & forth about the "Liberty Incident", but I'm not prepared to dismiss the possibility that it was intentional.