The scenarios differ depending on whether you file for bankruptcy jointly while still being married or separately after the divorce. The declaration of bankruptcy doesn’t automatically eliminate all debt obligations to the creditor. Hence, the collectors may come after you if your spouse cannot pay their share of marital debt and vice versa.
The court may also oblige the other party to meet the debt obligations after the other one files for bankruptcy. If you cannot meet these obligations either, you will have to file for bankruptcy too. Joint filing for bankruptcy reduces the risks of such scenarios as in such cases, your debt is still viewed jointly and either of the parties cannot be held accountable separately.