Terahertz communication, as one of the key technologies for 6G, is considered an effective means of addressing the scarcity of spectrum resources and improving system capacity. However, due to high path loss and the molecule absorption, terahertz is easily blocked by obstacles leading to communication interruptions. To address this problem, Reconfigurable Intelligent Surface (RIS) is introduced into terahertz communication systems and the impact of channel uncertainty on transmission stability is considered to establish a multi-user energy-efficiency maximization beamforming model based on user quality of service constraints, base station transmit power constraints and RIS discrete phase shift constraints. The original nonconvex optimization problem is solved by transforming it into a convex optimization problem using Dinkelbach, continuous convex approximation, S-procedure, semi-positive definite relaxation, phase mapping and block coordinate descent. Simulation results show that the proposed algorithm improves the energy efficiency by 15.4% and reduces the outage probability by 15.48% compared with the traditional non-robust beamforming algorithm.