Friday, February 26, 2016

Sitecore content editor Post condition failed

On a Sitecore development machine (single server environment), the front-end was loading correctly but when attempting to load the content editor the following error appeared in the logs:

Post condition failed

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Post condition failed

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[InvalidOperationException: Post condition failed]
   Sitecore.Diagnostics.Assert.ResultNotNull(T result, String message) +85
   Sitecore.Web.UI.HtmlControls.Data.DataViewFactory.GetDataViewByName(String name) +855
   Sitecore.Web.UI.HtmlControls.Data.DataViewFactory.GetDataView(String name, String parameters) +63
   Sitecore.Web.UI.HtmlControls.DataContext.get_DataView() +359
   Sitecore.Web.UI.HtmlControls.DataContext.GetItem(String id) +42
   Sitecore.Web.UI.HtmlControls.DataContext.GetState(Item& root, Item& folder, Item[]& selected) +670
   Sitecore.Shell.Applications.ContentManager.ContentEditorForm.OnLoad(EventArgs e) +541

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +128
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +146
   Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj) +89
   Sitecore.Web.UI.Sheer.ClientPage.OnLoad(EventArgs e) +592
   System.Web.UI.Control.LoadRecursive() +68
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4498

This was due to a switch master to web config file being included in the deployment package. Removing this file corrected the error


  1. Hi Ryan,

    THanks for sharing this pose. I am running into the same type of error with a very similar stack trace. Took out the SwitchMastertoWeb.config file but I am still getting the error. Any idea what else might be causing the issue?

    Highly scaled website project with many config files running SC 7.2

    1. Is the error happening on CM or CD and is it only appearing when you load the admin area?