I managed to execute the move. The problem was that there was a neutral unit next to my one. But it was covered by shroud. I used another unit to uncover the neutral and then the attack succceded.
Maybe there could be solution to recheck stack sight range when entering stack stats.