Every year 400,000 entrepreneurs fail and 60,000 file for personal bankruptcy. The option to declare bankruptcy provides entrepreneurs with insurance against the financial consequences of business failures. However, it comes at the cost of worsened credit market conditions. In this paper, we construct a quantitative general equilibrium model of entrepreneurship to show that the presence of secured credit in addition to unsecured credit substantially alters the trade-off between insurance and credit conditions. A lenient bankruptcy law always worsens credit conditions, in particular for poor entrepreneurs. If secured credit is not available, their credit conditions are so bad that many prefer to become workers. In that case, we show that the optimal bankruptcy law is very harsh because the benefits from better credit conditions dominate the worsened insurance. However, if secured credit is available, entrepreneurs who might be rationed out of the unsecured credit market can still obtain secured credit. Therefore, they can run larger firms, which makes entrepreneurship more attractive. Since the presence of secured credit lowers the cost of a generous bankruptcy law, we find that the optimal law is lenient in this case: moving to the optimal bankruptcy law would increase entrepreneurship by more than four per cent.