Nope, artillery shells are not illegal and you can even miss where you are aiming! We once obliterated an entire French coastal village with naval gunfire on D-Day because information in war is imperfect.
Accidentally killing civilians is not illegal in war! If you have a "valid military target" who takes a cab from the airport, you can airstrike that cab and not violate the Geneva Conventions.
Consider that a nuke that you detonate in the center of a military base that also "just happens" to wipe out the entire city that base is in is not a war crime!