A mortar and rocket attack timed to produce dozens of wounded and kill 22 is not amateur hour. It also lends credence to the notion voiced by some U.S. commanders that their attackers receive support from nearby Syria, and/or Iran. The Kurds are also upset with elections planned for next month and are talking boycott.
All in all, a classic snafu.
Update: There is now a claim that the attack was a suicide bomber mission, but the official investigation continues.