The problem is that bankruptcy is a serious derogatory mark on your credit.
It won’t prevent you from getting credit in the future, but for a time some credit products will be unavailable to you and others will come at very steep prices.
There are federal student loans and private student loans. If you have both, you should never consolidate federal and private loans together.
They’re separate animals, so to speak, and you just shouldn’t try to combine them.
The decision whether you should consolidate your loans is complicated.