How to fix: Error in SharePoint when custom master page is applied

UPDATE: Found this get hit through our support channels several times last week. As it turns out, depending on the missing content placeholder (or other pieces), the cause of the error may be different than just creating new list items; like I previously stated. Therefore, I "genericized" my post to be more applicable to a wider-range of situations. Same steps apply to find what's causing the issue, though.  


After changing to a customized master page, creating new items for several lists, along with several other operations, no longer works and result in an error message.


"An unexpected error has occurred."


There may be several causes. One, is that the custom master page is missing necessary content place holders.


Method 1: Identify the missing content place holders by modifying the web.config.

  1. Browse to c:\inetpub\wwwroot\wss\virtualdirectories\[port of web application]. Note: in this folder you will find a web.config file.
  2. Open the web.config file in Notepad (or like-application).
  3. In Notepad, click Edit -> Find, enter "custom" (without quotes). Click Find Next. You should find the following node: <customErrors mode="On" />. Change mode from "On" to "Off".
  4. In Notepad, click Edit -> Find, enter "callstack" (without quotes). Click Find Next (change direction Up / Down, if needed). You should find the following node: <SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">. Change the CallStack attribute from "false" to "true".
  5. Save the web.config file, and perform an iisreset /noforce.
    • NOTE: After performing the above steps, attempt to reproduce the error in the web browser. The error message should be descriptive in terms of what content place holder is missing. Take note of the place holder name.
  6. Open the master page, and in code view add: <asp:ContentPlaceHolder id="PlaceHolderName" runat="server" />. Replace PlaceHolderName with that of the actual content place holder name that was shown in the error message from step 5.

Method 2: Find the missing content place holders manually.

  1. Open SharePoint Designer 2007. Go to File | Open Site and connect to SharePoint site.
  2. Expand out _catalogs -> masterpage -> open customized master page.
  3. Go to Code view. Go to Edit | Find.
  4. In the Find and Replace dialog, enter: "<asp:contentplaceholder" (without quotes). Click Find All.
  5. Reference the occurrences found in the file with that of available content place holders:
    • PlaceHolderBodyAreaClass
    • PlaceHolderBodyLeftBorder
    • PlaceHolderBodyRightMargin
    • PlaceHolderCalendarNavigator
    • PlaceHolderFormDigest
    • PlaceHolderGlobalNavigation
    • PlaceHolderHorizontalNav
    • PlaceHolderLeftActions
    • PlaceHolderLeftNavBar
    • PlaceHolderLeftNavBarBorder
    • PlaceHolderLeftNavBarDataSource
    • PlaceHolderLeftNavBarTop
    • PlaceHolderMain
    • PlaceHolderMiniConsole
    • PlaceHolderNavSpacer
    • PlaceHolderPageDescription
    • PlaceHolderPageImage
    • PlaceHolderSearchArea
    • PlaceHolderSiteName
    • PlaceHolderTitleAreaClass
    • PlaceHolderTitleAreaSeparator
    • PlaceHolderTitleBreadcrumb
    • PlaceHolderPageTitleInTitleArea
    • PlaceHolderTitleLeftBorder
    • PlaceHolderTitleRightMargin
    • PlaceHolderTopNavBar
    • PlaceHolderUtilityContent
    • SPNavigation
    • WSSDesignConsole
  6. Iteratively add any missing content place holders to the master page in the form of: <asp:ContentPlaceHolder id="PlaceHolderName" runat="server" />. Replace PlaceHolderName with that of the actual content place holder name.
  7. Save master page (Check In, and Approve if necessary) after each added content place holder, and test to see if error still occurs. 

NOTE: In SharePoint Designer 2007, go to View | Toolbars | Master page to bring up the master page toolbar. This may also help in identifying place holders currently used on the customized master page.

Additional Information:

I hope this helps some of you SharePoint branders out there running into similar problems. Certainly, there are few things more frustrating then finding out your beautiful and slick-looking master page is actually causing SharePoint to fail. With that said, I am interested in learning what kind of problems you've ran into with customized master page files with SharePoint, and how you resolved the issues.