If you have the patterns module installed and are also running the securepages module to have SSL enabled on your site there is a bug in the patterns module in hook_exit().

When the securepages module tries to redirect you from http to https version of your site it redirects and invokes the exit hook, upon which the following error is generated from the patterns module -

batch_get() function is undefined; presumably coming from the first line in patterns_exit() - $batch =& batch_get();