This error normally comes when you try to create a site collection. In order to avoid this issue just follow these steps:
On the the top-level site in the site collection
Click on Site Actions > Site Settings > 'Site collection features' > 'Site Collection Administration' >Click activate next to Office SharePoint Sever Publishing Infrastructure
or just follow the screens: