My defense is next week and and I have found an error in one of the proofs in one of the chapters of the thesis. What to do?
First, tell your advisor immediately. Your defense might need to be rescheduled. Suggest that if you think it wise. 

Next, of course, try to provide a correct derivation. 

If you have to go to the defense in the current state, yes, admit and point out the error and state that you are working on a patch. The committee might let you finish as is and clean up the problem later. They might also delay your finish until you have a correct result (or proof that it is not correct). I doubt that this is grounds for complete failure as it would be if the error is pointed out by someone else. 

But your advisor might override any of this advice. That is your best source. 

I've been on a final defense committee where we decided the work wasn't ready due to some flaws. The candidate just had to go back to work and we scheduled a future date. But it turned out that the meeting itself was valuable for the candidate as he got some feedback that helped him to the end.