See actual SharePoint error exception modify web.config

SharePoint errors and exceptions

Whenever something goes wrong in SharePoint, you are greeted with a non-useful error message like below -

SharePoint 2007 - An unexpected error has occurred.

SharePoint 2010 - An unexpected error has occurred.

SharePoint 2013 - Sorry, something went wrong.

Display meaningful and developer-friendly error

Make the following changes to the corresponding web.config file of your site by following the below steps.

  1. Navigate to the virtual directory of your web application (usually located at C:\inetpub\wwwroot\wss\VirtualDirectories). For example, if your site is hosted on port 80 then open the folder 80.
  2. Locate web.config file and create a backup (backup is very important, just in case something goes wrong)
  3. Open the web.config in any editor which you are comfortable (Notepad, Notepad++, WordPad, EditPlus, Word, etc). Visual Studio will be my preferred editor.
  4. Locate the tag . There is an attribute CallStack which is set to False by default. Set this attribute to True. This will allow SharePoint to enable stack trace and display the actual details of error/exception.
  5. Locate the tag . There is an attribute mode which is set to On by default. Set this attribute to Off. This will enable custom errors instead of showing user-friendly messages.
  6. Refresh the page with the error and now you should see more details that are useful to the developer for troubleshooting.
  7. This is how your changes should look.
<SafeMode CallStack="true" ............... >

<customErrors mode="Off" />

⚠️ Important: This is recommended only in Development environments and you should not fiddle with the web.config in production environments. The purpose of enabling and custom errors and complete stack trace is only for easier troubleshooting and developers are recommended to revert the changes once development is completed.

Try Out Code2care Dev Tools:


Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR -