Something can be both a “terrible mistake” and also a violation of international law.
At a high level, it seems unlikely that American military leaders would intend to bomb a hospital, considering the horrible human toll and subsequent political and public relations disaster.
Perhaps the investigation will turn up a more complete story about why the hospital was targeted.