+4  A: 

Hi Mark, imho this behavior makes sense, as you turn debug to 0 if your app goes into production (something tells me, that you don't want to show the home page as your entry page). The home.ctp which is displayed by the pages controller lives in

./cake/libs/view/pages/home.ctp

of your installation. But if you are in production you want to display the static pages from the

./app/views/pages

directory, which is the task of the pages controller. This directory is empty in a fresh cake installation.

Kind regards, Benjamin.

benjamin
+1, nice catch, that's probably it. I remember this was not a case a while ago, but someone reported it as a potential security issue.
dr Hannibal Lecter
I already copied pages_controller.php from cake/config/controller into app/controller, and I copied home.ctp to app/views/pages. When debug > 0 the page served is definitely app/views/page/home.ctp, but when debug=0 I get the error. I have not altered the default() action in pages_controller.php that comes with standard cake install. I'm not quite sure what happens in that function but maybe something in there is affected by the change in debug value? I'm not sure I can post code into a comment so I'm editing the question to include the code for the default() action.
Mark Flint
+2  A: 

OK the answer is so simple it is embarassing: in home.ctp there is the following code:

if (Configure::read() == 0):
    $this->cakeError('error404');
endif;

Configure::read() by default read var debug - therefore it throws this error if debug is set to 0.

Thanks to Benjamin for putting me on the right track. Cake is wonderful and at the same time infuriating until you know the basics!

Mark Flint