The position is indeed illegal but that's not the reason SF can't solve it. The reason is that SF is simply not good at solving puzzles. It will prioritize searching moves that work in games which are precisely the moves that don't work in puzzles. It's part of the definition of puzzles that they carry an element of paradoxicality from the experience of a game player. Every time SF does solve a good puzzle it's only because it can find the required mates and stalemates by calculating all the relevant variations. It goes wrong whenever some doubt remains as to the final outcome because its positional judgement is poor for puzzle positions.
Stockfish at depth 40 fails to solve this puzzle. Can you do it?
@ACoolKVPlayer If you are interested in composing puzzles, then you might want to join my club, The Problemists' club.
https://www.chess.com/club/the-problemists-club#:~:text=Support-,The%20Problemists%27%20club,-4%20Medlemmar
It is white to move and win the game. The position is not legal, however for the sake of puzzle we assume it is. FEN: 1rkr1b1b/2p1pKp1/1pPpP1Pp/3P1p1P/1P3p2/3pp3/8/R1B4N w - - 0 1
P.S. I'm the composer of this puzzle.