Error in edit view - equence contains more than one element

We started to see this kind of error messages in the edit mode of a QuickSilverbased CMS/Commerce site running version CMS 9.8.2 and Commerce 9.13. No real idea of why it has occurred.

317 {message: "Unable to load /episerver/cms/Stores/contenttype/?dojo.preventCache=1463574636969 status: 500", response: Object, status: 500, responseText: "<!DOCTYPE html>
↵<html>
↵    <head>
↵        <titl…nStep step, Boolean& completedSynchronously)
↵-->", xhr: XMLHttpRequest}
message
:
"Unable to load /episerver/cms/Stores/contenttype/?dojo.preventCache=1463574636969 status: 500"
response
:
Object
responseText
:
"<!DOCTYPE html>
↵<html>
↵    <head>
↵        <title>Sequence contains more than one element</title>
↵        <meta name="viewport" content="width=device-width" />
↵        <style>
↵         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
↵         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
↵         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
↵         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
↵         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
↵         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
↵         .marker {font-weight: bold; color: black;text-decoration: none;}
↵         .version {color: gray;}
↵         .error {margin-bottom: 10px;}
↵         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
↵         @media screen and (max-width: 639px) {
↵          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
↵         }
↵         @media screen and (max-width: 479px) {
↵          pre { width: 280px; }
↵         }
↵        </style>
↵    </head>
↵
↵    <body bgcolor="white">
↵
↵            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
↵
↵            <h2> <i>Sequence contains more than one element</i> </h2></span>
↵
↵            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
↵
↵            <b> Description: </b>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.
↵
↵            <br><br>
↵
↵            <b> Exception Details: </b>System.InvalidOperationException: Sequence contains more than one element<br><br>
↵
↵            <b>Source Error:</b> <br><br>
↵
↵            <table width=100% bgcolor="#ffffcc">
↵               <tr>
↵                  <td>
↵                      <code>
↵
↵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.</code>
↵
↵                  </td>
↵               </tr>
↵            </table>
↵
↵            <br>
↵
↵            <b>Stack Trace:</b> <br><br>
↵
↵            <table width=100% bgcolor="#ffffcc">
↵               <tr>
↵                  <td>
↵                      <code><pre>
↵
↵[InvalidOperationException: Sequence contains more than one element]
↵   System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source) +423
↵   EPiServer.DataAbstraction.RuntimeModel.ModelAttributeCollection.TryGetSingleAttribute(T& attribute) +59
↵   EPiServer.Cms.Shell.UI.Rest.ContentTypeStore.GetImagePath(ContentType type) +131
↵   EPiServer.Cms.Shell.UI.Rest.ContentTypeStore.ToContentTypeViewModel(ContentType type) +370
↵   System.Linq.WhereSelectListIterator`2.MoveNext() +111
↵   Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty) +549
↵   Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) +409
↵   Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) +1341
↵   EPiServer.Framework.Serialization.Json.JsonObjectSerializer.Serialize(TextWriter textWriter, Object value) +71
↵   EPiServer.Shell.Services.Rest.RestResultBase.ExecuteResult(ControllerContext context) +298
↵   EPiServer.Shell.Services.Rest.RestResult.ExecuteResult(ControllerContext context) +23
↵   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +90
↵   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +833
↵   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +833
↵   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81
↵   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +186
↵   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
↵   EPiServer.Shell.Services.Rest.RestControllerBase.EndExecute(IAsyncResult asyncResult) +60
↵   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399
↵   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +137
↵</pre></code>
↵
↵                  </td>
↵               </tr>
↵            </table>
↵
↵            <br>
↵
↵            <hr width=100% size=1 color=silver>
↵
↵            <b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1073.0
↵
↵            </font>
↵
↵    </body>
↵</html>
↵<!-- 
↵[InvalidOperationException]: Sequence contains more than one element
↵   at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
↵   at EPiServer.DataAbstraction.RuntimeModel.ModelAttributeCollection.TryGetSingleAttribute[T](T& attribute)
↵   at EPiServer.Cms.Shell.UI.Rest.ContentTypeStore.GetImagePath(ContentType type)
↵   at EPiServer.Cms.Shell.UI.Rest.ContentTypeStore.ToContentTypeViewModel(ContentType type)
↵   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
↵   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
↵   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
↵   at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
↵   at EPiServer.Framework.Serialization.Json.JsonObjectSerializer.Serialize(TextWriter textWriter, Object value)
↵   at EPiServer.Shell.Services.Rest.RestResultBase.ExecuteResult(ControllerContext context)
↵   at EPiServer.Shell.Services.Rest.RestResult.ExecuteResult(ControllerContext context)
↵   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
↵   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
↵   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult)
↵   at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
↵   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
↵   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
↵   at EPiServer.Shell.Services.Rest.RestControllerBase.EndExecute(IAsyncResult asyncResult)
↵   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
↵   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

In the episerver log we also get errors like this if they might be connected

2016-05-18 12:01:14,163 [235] ERROR EPiServer.Packaging.Storage.StateStorage: There are more than one record in StorageUpdateEntity data store for server with id dd464cca-c85b-48a2-abdd-a8a78656083f. Extra records will be deleted.
#148615 May 18, 2016 14:42
  • Hi,

    It looks you have duplicated attribute somewhere: "ModelAttributeCollection.TryGetSingleAttribute"

    #148627 May 18, 2016 19:22