1) use eztc.php to rebuild your template compile.
2) don't remove all your cb and cache content at the same time.
3) reduce the number of SQL query generate by your tpl. on a small dev mysql server sometime we have this error if there is a lot of query in the page or a lot of user at the same time