Self-reconfigurable modular robots consist of many identical modules. By changing the connections among modules, the configuration of the robot can be transformed into other configurations. For the self-reconfigurable modular robot, one of its main functions is its self-repairing ability. First, the module of the lattice-type self-reconfigurable robot is presented. It is composed of a central cube and six rotary arms. On each rotary arm the docking mechanism is designed to show the self-repairing ability. Second, the basic motion of the self-reconfigurable robot is described to change the positions of the module. The state matrix and the location matrix are proposed to describe the connection states. Third, a self-repairing algorithm based on the positions of the faulty modules is presented. The algorithm applies the Breadth-First-Search method and the Depth-First-Search method to find a locomotion path by which the faulty module is ejected and replaced by a spare module. At last, a simulation on the fourth-order lattice-type self-reconfigurable robot consisting of 729 modules shows the feasibility and effectiveness of this self-repairing algorithm in three dimensions.