This is war. Any hostile action in armed conflict can, and will, have collateral damage to the innocent. Acts of terror and war crimes are determined by who is targeted, what precautions are taken to minimise collateral damage, and how significant is the military target compared to expected collateral damage.
If you don't want to kill any innocent civilians, your only course of action is not to offer any resistance to people who attack you and surrender.
That last paragraph is disingenuous at best because there is a miles-wide valley of options between setting off explosives in peoples' pockets and surrender.
No, this paragraph explains that "this attack killed innocent" is not a good argument if you want to prove that this was a war crime or an act of terror. If you want to prove something like this, your argument should be "this attack targeted innocents", "reasonable precautions to minimise damage to innocents were not taken", or "the military significance of target is insignificant compared to damage to innocents".
If you don't want to kill any innocent civilians, your only course of action is not to offer any resistance to people who attack you and surrender.