L’Exode 22:1 Commentaire : Rashi, Rashbam, Rabbeinu Bahya & Siftei Chakhamim

אִם־בַּמַּחְתֶּ֛רֶת יִמָּצֵ֥א הַגַּנָּ֖ב וְהֻכָּ֣ה וָמֵ֑ת אֵ֥ין ל֖וֹ דָּמִֽים׃

"Si un voleur est pris sur le fait d’effraction, si on le frappe et qu’il meure, son sang ne sera point vengé.

Rashi on Exodus

אם במחתרת means when he was breaking in into the house (i. e. in the very act of forcing an entry, but at no other moment).

Rashbam on Exodus

אם במחתרת, as well as at night, prepared to either kill or be killed in the pursuit of his quest. This is why there is no demand to account for his blood which has been shed. אין לו דמים, the killer does not even have to make financial restitution to the slain thief’s next of kin.

Rabbeinu Bahya

אם במחתרת ימצא הגנב, “If the thief is found while in hiding.” The word מחתרת suggests that he was tunneling his way into the house in the dark of night.
אין לו דמים, “there is no blood-guilt on his account.” If the owner killed the thief believing his life to be in danger he is not accused of manslaughter. The Torah presumes that if someone breaks into a house at night he is also prepared to kill if discovered by the owner who would defend his property.