I got the following error (see below) after deploying and Ajax based web part to a SharePoint 2007 (yikes!) server.
I had manually made the required web.config entries earlier, and the web part by itself does not really do anything funky. It consisted of a ScriptManager, an UpdatePanel and a ProgressPanel. Looking around I realised that there was no problem with it prior to OnPreRender.
Following this forum thread I got to resolve the issue. Essentially, make sure the EnsureChildControls() is called on OnInit(), as below:
protected override void OnInit(EventArgs e)