In some circumstances, you can switch energy supplier even if your current supplier says you can't leave. If you're in debt to your supplier, whether you can leave or not will depend on how long you've been in arrears.
If you've been in arrears for 28 days or less, then you have the right to switch to another supplier. The money you owe will be added to your final bill with the old supplier.
If you've been in arrears for over 28 days, then you must pay the arrears off before you leave. An exception to this is if it's the energy supplier's fault that you're in arrears, for example if they made an incorrect estimation of your bill.
The rules are different if you pay in advance for gas and electricity usage via a payment meter. Payment meter customers can switch supplier if they owe less than £500 for gas or £500 for electricity. However, the new supplier will need to agree to take ownership of the debt as well as the supply. This is known as the ‘Debt Assignment Protocol’.
If you feel you've been treated unfairly by your energy supplier, you can raise a complaint with them following their complaints process. It's a good idea to think about how you'd like your complaint to be resolved, for example whether you'd like an apology or reimbursing.
If you're not satisfied with the outcome, you can escalate your complaint to Ombudsman Services. It's free to do so, and they'll review the evidence before making an impartial decision.