You receive an error when you create a page, as a SharePoint Member, for the first time in a sub-site

We ran into a little issue the other day when using an account with only Member rights (yes yes, we are usually admins :)), we were creating a page for the first time in a sub-site and we were receiving a beautiful stack trace of nothingness.  We refreshed the page and it was working fine, the page was added.  With an account that's admin or owner, we didn't have that problem.

 

Now, we are creating the whole site structure programmatically through an STSADM and we are setting the AvailablePageLayouts collection per web application as to limit the type of pages authors can create for each sub-site.  And I remembered an issue with Variations where the ContentTypes collection for each "target" variations weren't set correctly by the variation job.  So I guessed right, we pre-populated the ContentTypes collection for each sub-site to contain a reference of all site content types that we accept for each sub-site and the error disappeared.  Since we had the whole extension with an Xml input, it wasn't hard at that point to add "Available" ContentTypes to it.

 

It's quite possible that the GUI for updating AvailablePageLayouts does that, I didn't use Reflector on it nor did I check the ContentTypes collection when using the GUI, but my guess would be that the error's a bug since if you refresh the page creation, the content type is indeed added at that point and the 2nd creation will work.

 

Maxime