A UN fact-finding mission concluded that the US intentionally targeted a school building in Iran that was struck on the opening day of the war, rejecting the possibility that the school was accidentally hit during an attack on a neighboring Iranian military facility. The investigators found reasonable grounds to believe the attack constituted a war crime.
So if it is by mistake it is okay?
If a reckless driver cause an accident, he or she is still charged based upon the harm and damage they caused.
But in war it is as if, as long as you claim it wasn't on purpose then it is okay.
Never forget that the allied Nations killed between 7 and 9 million Civilian Germans after the end of WW2. And that during the end of the war they bombed every German city with a population over 25.000 souls.
They were never charged with war crimes.