🐞 fix: check if template parent exists(cherry picked from commit 05c3924b209d9ed3a5d8085925a1d9aa2765e567)