This paper studies the disruption of bank business credit during a financial crisis in a model with optimal long term contracting under agency frictions and a directed search market for bank funding. Banks commit to long term contracts with entrepreneurs but then face heterogeneous shocks to their cost of funds during a crisis. The optimal contract can be implemented using standard debt securities and a “covenant” that allows bankers with high funding costs to adjust debt terms once the entrepreneur has accumulated sufficiently many losses. This is consistent with empirical evidence from the recent financial crisis. In general equilibrium, the contracting frictions amplify the crisis by increasing the termination rate of projects and decreasing the financing rate. The model is extended to incorporate project heterogeneity and working capital. The frictions then skew the economy towards lower volatility projects and sub-optimally reduce project size.