+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Sequence contains more than one matching element

Sequence contains more than one matching element

25 posts, 0 answered
  1. Davide Vernole
    Davide Vernole avatar
    6 posts
    Registered:
    13 Dec 2005
    07 Mar 2011
    Link to this post
    Hi,
    I'm experiencing this issue when I try to open the backend page to manage Pages. I receive this message in a javascript popup windows: "Sequence contains more than one matching element". Could anyone help me to resolve this issue? I cannot manage my website without access to that page.

    Thanks in advance for your support

    Davide Vernole
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 Sep 2016
    07 Mar 2011
    Link to this post
    Hello Davide,

    Please check the request and response from the web service that is called when you try to click on pages. Is this a new project, upgraded project or some old installation you are using?

    Kind regards,
    Ivan Dimitrov
    the Telerik team
  3. Davide Vernole
    Davide Vernole avatar
    6 posts
    Registered:
    13 Dec 2005
    07 Mar 2011
    Link to this post
    Hii Ivan,
    here your are the request and response that I have captured by using Firebug:

    Request
    Host: local.knodev.com
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 115
    Connection: keep-alive
    X-Requested-With: XMLHttpRequest
    SF_UI_CULTURE: it
    Referer: http://local.knodev.com/Sitefinity/Pages
    Cookie: .SFAUTH=C75FBFC8F99AE8A93A5E0202D1E1D4002EE8E3E7647F7EF620CB73B52DC5490F8D6A7B49B821EE51AB4E24D1FE98866F79A47C686713419554B708D7A8D22C91A865F05834368BDF6AA9DEC23CC4C1924E405F94487E736AAFBD0931A107558D7DF6C4D28E837C2B3EC01DB9602459C3B3D718558598A14CE412D4527A697D4590D7F6C0CB926C4D6B662BA75D1986DB8959B337EEEC61F1BD7DF98AFE849DADB0876583619A27875B02D4ADD72D4B744C343367E61BFBA5B8F5AD65B1444CF2573FFBC12F66424B2186D8E741987E571888964232F4DF06634ACF1752C1C173AB457FF89E6C026FBA64328F43D6759E466B83ECC302A6169B805BD699F54DD0; .SFROLES=mY066dxR2yazYdYNopo24/XA+vXpC3xLMkJuSFftdZW+xwBJvZDK2h5phwLy9b930U3Wf4FA9h9feuDX0ARfEhbDpFBfty3avHaDoIRD6mqGp91xFsUvMKEJf0hQ8P6sq5VenRWL8v7sUav9z3U6a3kBD2RCRbM942EnelWpLMMbOw8LNP6N0/YE6in/+mxzg6AjwXYisOuY51qL2Zuu1SxC5USzA/xgaEvzDBjWbH2/kgBlBhvcVz37pOZCeuSGX/f+hvCgEGT9Nt42L4u1o1wBzM+sZ1aqJGYGFmkfg5V+bYzhuxny9HnJJ/IHyeF9U/de3MclX9PrNymC112zlVunRRxEca2XbkAccfpgKr+KvPjt05mbd7sXlW21cxMPG/hgxqIqZ/uh4CdgpDFDFjGMcKlNCJNh90s5m0/RNEu0O45MroqOvsMo2VhsMD34nQuYaqdLj67ggHAaUDArmD8DmskWjUp+JYtwcLLghSBmRpdZL2UYV5AljtsPgClo5DkHKdM4vyqQlNlXCCQmihu4oqrKiX1AxkAx56k7xs3ML5fIV0mdf5QB2/xlfEPillQhKKy4/DgTfXvBOU32agSoNt+6Y/WkKJ193gxvWCq7B6Gkli4+jn1tSW8T49h867xvGvNpvu0jyA6KQ+l1NeZ1HOe0JzkJmsrUZpOdwmAAYw30QglBw/cGgh0tDA8TGdGYiDuhYOjjpzi6COpncZIjMOVU9ai9U4A3NLpUgsuSPRb4k12zimJw9o6BoVz067Yc7qESI7GTlG/BBY3GnuDlHYjZ4AHDGCz9Bx8BIMJRiRnQI4AQrxFMBYjYSck7hCFG2L2CZCemvEhbtpK1NHQCAAA=; .ASPXAUTH=95F3C8C122CB89FD69A2BC427F992C54C602DB9428B487FDC6EBF45A2034F84D67DCF80AC261DDBD0D92B3967CA2D8FEC6141FD4061AB2B2D5A515F4D4F072F3054B3AFBD07FBACFC19B0DF544576BA023645BCAF281074D93FEF125613DFC10088242C926CC4AF36948DB55000A7B2B2E5D24949E21EA0F418C163A5B0EF1681FBFAEC676EBA5A366A6CBCB35CF53AE

    Response:
    Cache-Control: private
    Content-Length: 61
    Content-Type: application/json
    Server: Microsoft-IIS/7.5
    Set-Cookie: .SFAUTH=3D3594A5D7A93D665FAAEA14B14057FC409728E032E0A1B8A79EDBF408358A55C2A56D736F1CFD5B84BCA668B6CD7ECC6067871B9AF8D94F85ABDC0A0992CD10B2F385BFA05C445AE465F78DBB9596FE711BC36AFC6363B9FCEDC2486B13829D312D3157E31B4C964F537163891CD79B4219453BABB48B9F16D1623BB6F4FF8E080C534C29FAF281E9C597C0FF36519BE846DC74BB7A861C6315D27349BC2A396B350B51BE4A32539A5C0EEDDF7B451FD7804A475C5BE2FC5AA1FBE532B35E09D7A7EA279CE6693551DB19B8CB9B2CBC3FA66A3E92B9360B449720E92AAB4FB248A94D7C3CFA99810EA05EC8EB973EE680BE54000C2206EAE50BCD3BA42FDCB3; expires=Mon, 07-Mar-2011 13:47:37 GMT; path=/; HttpOnly
    X-AspNet-Version: 4.0.30319
    X-Powered-By: ASP.NET
    Date: Mon, 07 Mar 2011 11:47:37 GMT

    Location:
    http://local.knodev.com/Sitefinity/Services/Pages/PagesService.svc/?managerType=Telerik.Sitefinity.Modules.Pages.PageManager&providerName=&itemType=Telerik.Sitefinity.Pages.Model.PageNode&hierarchyMode=true&sortExpression=Title%20ASC

    Response Body:
    {"Detail":"Sequence contains more than one matching element"}

    Calling the URL by hand I have received this reply:

    File not found
    Firefox can't find the file at http://local.knodev.com/Sitefinity/Services/Pages/PagesService.svc/?managerType=Telerik.Sitefinity.Modules.Pages.PageManager&providerName=&itemType=Telerik.Sitefinity.Pages.Model.PageNode&hierarchyMode=true&sortExpression=Title ASC.

    This project in an upgrade from Sitefinity 4 to Sitefinity 4 SP1. The .svc file is in the right directory.

    Cheers
    Davide
  4. Davide Vernole
    Davide Vernole avatar
    6 posts
    Registered:
    13 Dec 2005
    07 Mar 2011
    Link to this post
    Hi Ivan,
    I have resolved the issue following an idea that Radoslav has shared with me. Cleaning the sf_draft_pages table from the duplicated draft pages that for any reason could be present in that table. In my support ticket I have suggested to Radoslav a change in your code to avoid this kind of issue again.

    Thanks for your support
  5. Basem
    Basem avatar
    131 posts
    Registered:
    22 Dec 2010
    23 Mar 2011
    Link to this post
    Same thing happens with me. I tried deleting the records in the sf_draft_page table, but no luck. It seems to happen with really long forms I think.

    Sequence contains more than one matching element

    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: Sequence contains more than one matching element

    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: Sequence contains more than one matching element]
       System.Linq.Enumerable.SingleOrDefault(IEnumerable`1 source, Func`2 predicate) +467
       Telerik.Sitefinity.Descriptors.DynamicFieldsTypeDescriptor..ctor(ICustomTypeDescriptor parent, Type type) +948
       Telerik.Sitefinity.Model.DynamicFieldsTypeDescriptionProvider.GetTypeDescriptor(Type objectType, Object instance) +354
       System.ComponentModel.DefaultTypeDescriptor.System.ComponentModel.ICustomTypeDescriptor.GetProperties() +63
       System.ComponentModel.TypeDescriptor.GetPropertiesImpl(Object component, Attribute[] attributes, Boolean noCustomTypeDesc, Boolean noAttributes) +412
       Telerik.Sitefinity.Model.DataExtensions.SetValue(IDynamicFieldsContainer dataItem, String fieldName, Object value) +33
       Telerik.Sitefinity.Modules.Forms.Web.UI.FormsControl.SaveFormEntry(FormDescription description) +565
       Telerik.Sitefinity.Modules.Forms.Web.UI.FormsControl.ProcessForm(FormDescription form) +137
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +145
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3410
  6. Kevin
    Kevin avatar
    20 posts
    Registered:
    14 Jun 2010
    24 Mar 2011
    Link to this post
    I'm having this problem on a project as well.   What records need to be cleaned out of the sf_draft_page table?   All of them or only those that are duplicates?

    Thanks.
  7. Davide Vernole
    Davide Vernole avatar
    6 posts
    Registered:
    13 Dec 2005
    24 Mar 2011
    Link to this post
    Hi Kevin,
    in my case only the duplicate records. This has resolved my issue and now my web site is online.

    Davide
  8. Chris Bryant
    Chris Bryant avatar
    33 posts
    Registered:
    07 Jul 2009
    22 Apr 2011
    Link to this post
    I'm now getting this error.  This is a brand new project under Sitefinity 4.1. 

    Clearing the sf_draft_pages table did not fix the issue.  I can create a new page, but when attempting to edit it, I get the error, "Sequence contains more than one matching element."

    Also, when attempting to edit a single page, I see 2 new records get inserted into sf_draft_pages.  Is this normal?

    I'm running into one issue after the next with Sitefinity...please help!

    Thanks,
    -Chris B.
  9. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    28 Apr 2011
    Link to this post
    Hi Chris Bryant,

    Can you please outline the steps you take in order to reach the problem on the new website? Instead of clearing the page drafts table can you please try using a variation of the code below:
    var manager = PageManager.GetManager();
    var pageDataList = manager.GetPageDataList();
    foreach (PageData pageData in pageDataList)
    {
        var drafts = pageData.Drafts;
        if (drafts.Count > 1)
        {
            for(int i=1;i<=drafts.Count-1;i++)
                manager.Delete(drafts[i]);
        }
    }
    manager.SaveChanges();


    All the best,
    Radoslav Georgiev
    the Telerik team

  10. Sowmya
    Sowmya avatar
    17 posts
    Registered:
    09 Dec 2010
    25 Jul 2011
    Link to this post
    Hi,
      I am getting the same error, but mine pops-up as soon as I click on Pages in the backend administration. This started after I attempted moving my dev db to prod. I merged all my dev records with production without deleting anything on the live database. Given the lack of knowledge to know which table means what, or whether we can delete records from certain tables or not, we had to retain the production records. The website seems to be working fine, frontend, however the backend is having issues.

      The lists, templates seem to be okay. Only the Pages is the looming issue. We are going live today and would greatly appreciate any assistance.

    Thanks,
    Soumya
  11. Dan
    Dan avatar
    3 posts
    Registered:
    08 May 2011
    25 Jul 2011
    Link to this post
    I had the same problem earlier, it seemed to be linked to a custom control of mine being incorrectly created. It had an error on creation as the Toolboxes.config file was not editable, so it was only partially created. To fix I had a backup of the DB just before, restored it, made sure the config files were writeable and then re-created the controls. You could probably achieve the same by just deleting the config sections in the administrative pages.

    Hope this helps,

    Dan
  12. Sowmya
    Sowmya avatar
    17 posts
    Registered:
    09 Dec 2010
    25 Jul 2011
    Link to this post
    Thanks for your reply Dan.
    How do I know which config file to clear and what should I clear?  
    Everything is working, only the Pages is having this problem. I cannot go back to my old database cause I need to use the new one to move to production. If it helps I am getting a 500 error when I saw on Fiddler, the url is
    Sitefinity/Services/Pages/PagesService.svc/?managerType=Telerik.Sitefinity.Modules.Pages.PageManager&providerName=&itemType=Telerik.Sitefinity.Pages.Model.PageNode&hierarchyMode=true&sortExpression=Title%20ASC
    The same is working on Dev. I merged DEV database with production and palced it on Staging whereI am getting this error.

    Any help would be greatly appreciated.

    Thanks,
    Soumya
  13. Dan
    Dan avatar
    3 posts
    Registered:
    08 May 2011
    26 Jul 2011
    Link to this post
    Hi Soumya,

    It sounds like to me that your database merge didn't work as expected and that in the process duplicate records have been created in some of the tables. I'm not overly familiar with a lot of the inner workings of Sitefinity so hopefully one of the admins will step in. Sorry I cant be much more help,
    Dan
  14. Sowmya
    Sowmya avatar
    17 posts
    Registered:
    09 Dec 2010
    27 Jul 2011
    Link to this post
    Hi Dan,

      Thanks a lot for replying back. Regarding the database merge I purposefully did not chose to delete the records on the target DB (production) cause I was not sure which records in which tables could go and which not. This is the price I am ready to pay till I get a better explanation from Sitefinity as to how to handle the merge or hopefully when they have the Site Synchro feature built in.. I will be eagerly waiting :)

      Coming to the error, I cleared the table of duplicates, I went of on is_temp_draft & page id as basis and tried to have only one of each combination.

     Now the errors are gone and everything working fine. I did have some more hiccups cause of the merge, of multiple controls of same id getting created on some pages, but I manually fixed them. I dont like this way, but will have to do till I find a more relaible way.

    thanks again for your response.

    soumya
  15. Daniel
    Daniel avatar
    4 posts
    Registered:
    27 Dec 2012
    08 Oct 2013
    Link to this post
    I'm getting this same issue but on my Products page which is preventing me from creating any products. How can this issue be resolved?
  16. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    Registered:
    04 Jan 2016
    11 Oct 2013
    Link to this post
    Hello,

    This issue for products can be caused if a users adds a custom field for a product type which has the same name as one of the default fields. We will add a validation that will prevent it from happening in a future version. 

    Regards,
    Atanas Valchev
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  17. Neha
    Neha avatar
    7 posts
    Registered:
    21 May 2013
    11 Nov 2013 in reply to Atanas Valchev
    Link to this post
    Hi,
    Sorry for the query on this old thread,but i am facing the same issue and getting error while deleting the sf_draft_pages .
    first i truncated the reference table sf_drft_pages_sf_language_data, but still giving th error:
    Cannot truncate table 'sf_draft_pages' because it is being referenced by a FOREIGN KEY constraint.
    could you please suggest me what are the tables need to delete for the same?
  18. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    Registered:
    04 Jan 2016
    14 Nov 2013
    Link to this post
    Hello,

    Would it be possible to share with us your exact scenario, please? It would be best if it can be done using the API, modifications directly in the database are not recommended and should be used only as a last resort. 

    Regards,
    Atanas Valchev
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  19. Bishoy
    Bishoy avatar
    27 posts
    Registered:
    15 Aug 2013
    06 Mar 2014
    Link to this post

    My Fix: 

    - Try to figure out which Metafield caused this problem 
    - It happened couple of time to  me because of the "Weight" metafield till I figured out that even after deleting the field, I have to make sure to delete it from CatallogConfig.config 
    - To delete the field just run the following code 

    var manager = MetadataManager.GetManager();
                   var fields = manager.GetMetafields().Where(f => f.FieldName == fld);
                    foreach (var field in fields)
                    {
                        manager.Delete(field);
                    }
                    manager.SaveChanges();
    Take care not to delete sitefinity reserved fields, just delete your custom fields 

    the above function only deleted the fields from the database, so you'll nee to delete your custom field also from the config file mentioned above 

  20. Dave
    Dave avatar
    76 posts
    Registered:
    10 Mar 2008
    13 Mar 2014 in reply to Bishoy
    Link to this post

    I am also getting this error, repeatedly.  It happens when creating a custom User Profile.  This is unacceptable... this error has been happening since 2011 (!) and the error message returned is next to useless.

  21. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    Registered:
    04 Jan 2016
    14 Mar 2014
    Link to this post
    Hello,

    The error can occur if there multiple fields with the same name in the database/configurations and the system expects only one which in turn causes the error. I would like to suggest opening a ticket in order to get project and help you locate the field and fix the issue.


    Regards,
    Atanas Valchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  22. Dave
    Dave avatar
    76 posts
    Registered:
    10 Mar 2008
    19 Mar 2014 in reply to Atanas Valchev
    Link to this post

    Sitefinity support was able to fix my configuration file accordingly and solve my issue.  I still think that more care should be taken around this error.  Sitefinity should give you a descriptive error message, and ideally let you remove/replace the duplicate field.

  23. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    Registered:
    09 Sep 2016
    24 Mar 2014
    Link to this post
    Hello,

    Recently we logged two bugs regarding custom fields in user profiles. Please find the bugs' descriptions on the following links:

    http://feedback.telerik.com/Project/153/Feedback/Details/123459-custom-fields-with-same-names-could-be-added-to-custom-profiles

    http://feedback.telerik.com/Project/153/Feedback/Details/123501-custom-fields-with-same-name-as-deleted-fields-could-be-added-to-custom-profiles

    Regards,
    Stefani Tacheva
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  24. Dave
    Dave avatar
    76 posts
    Registered:
    10 Mar 2008
    25 Mar 2014 in reply to Stefani Tacheva
    Link to this post

    Thank you for acknowledging these bugs Stefani.

  25. Daniel
    Daniel avatar
    4 posts
    Registered:
    27 Dec 2012
    15 Apr 2014 in reply to Daniel
    Link to this post

    The fix for me turned out to be removing any reference to the bad product classification field from the catalogConfig file found here: /App_Data/Sitefinity/Configuration/CatalogConfig.config

25 posts, 0 answered