This article provides a two-stage robust energy management method for a self-healing smart building that can handle contingencies that occur during real-time operation. Aside from an electrical link with the distribution network, the smart building is equipped with a diesel generator and photovoltaic solar power generating systems. The energy management system should be smart enough to plan different resources based on the situation. At first, bi-level programming identifies critical faults for affected components based on mean-time-to-repair. After identifying major failures, the faults are described in operational scenarios, and two-stage hybrid robust-stochastic programming technique is used to determine the bid/offer in day-ahead and real-time energy markets, in which stochastic programming is responsible for considering the uncertainty of faults, and the robust optimization approach is used to cope with the uncertainty of real-time market prices. After linearization, the final optimization is modeled as mixed-integer linear programming in GAMS optimization package. For the studied smart building, the daily operational cost is expected to increase from $ 25.794 (for the deterministic case) to $ 28.097 (for the most conservative case) due to the uncertainty of real-time market prices. Due to power shortages caused by the failure of components, the total expected not-supplied load is 6.72 kW (2.53%). A comparison between a naive, and self-healing scheduling indicated that a naive energy management will charge additional $ 2.75 without considering the probability of components failures under the deterministic case.