Could not load SysCampaignRoot from tblContent that should have ContentGUID ...

Vote:
 

Could not load SysCampaignRoot from tblContent that should have ContentGUID '48E4889F-926B-478C-9EAE-25AE12C4AEE2'

I am now getting this error message when trying to access the EPiServer CMS UI. On our site it is located at /EPiServer/CMS. Apart from that the site seems to be working as it should. All my unit tests are now working after upgrading EPiServer.CMS.Core to 7.19.1 from 7.19.0.

This error message appears on both my local machine and on our development machine after trying to publish the upgrade there and after runing the cmdlet "update-epidatabase".

The only thing I changed was this:

* Upgrade EPiServer.CMS from 7.19.0 -> 7.19.1

* Upgrade EPiServer.UI from 7.18.0. -> 7.18.2

* Finding out that I did not have the mother/father package EPiServer.Commerce installed at all, installing it

* Upgrading EPiServer.Commerce.Core from 8.5.0 -> 8.6.1 (in the process of upgrading installing the entire EPiServer.Commerce mother/father package)

(EPiServer Commerce was set up and working even without the EPiServer.Commerce package before though). I can not be sure every single part was working perfectly though as we just installed before christmas for evaluation).

The full stack trace can be found here: http://pastebin.com/zuwqnMEV

For now I will have to restore the database to a backup and perform a downgrade. Is this a bug with the newer EPiServer Commerce. Or something wrong with our setup? Or is our database corrupt somehow?

#115259
Jan 12, 2015 16:34
Vote:
 

Hi,

Can you take the 8.0.1.1.sql file in EPiServer.Commerce.Core package, folder epiupdates_CMS/sql and run it manually to see if it solves your issue?

Regards.

/Q

#115261
Jan 12, 2015 16:47
Vote:
 

I ran it. It didn't help. It says 'Verifying/creating Campaign root...' and then procedes to do nothing.

You pointed me in the right direction though, I was able to solve the issue. I started decompiling the EPiServer sources with DotPeek and starting looking into the database.

This is the EPiServer method that fails:

private static ContentReference GetCampaignRoot()
    {
      try
      {
        return ServiceLocator.Current.GetInstance<IContentLoader>().Get<IContent>(CampaignFolder.CampaignRootGuid).ContentLink;
      }
      catch (ContentNotFoundException ex)
      {
        throw new InvalidOperationException("Could not load SysCampaignRoot from tblContent that should have ContentGUID '48E4889F-926B-478C-9EAE-25AE12C4AEE2'");
      }
    }

I could not figure out for the life of me how something simple as that could fail. I DID have a SysCampaignRoot in the tblContent, tblWorkContent, tblContentLanguage and tblContentType tables. It did have the correct Guid (the same one as the variable CampaignFolder.CampaignRootGuid)

private static readonly Guid CampaignRootGuid = new Guid("48E4889F-926B-478C-9EAE-25AE12C4AEE2");

It also had the same GUID in the database.

I DID finally notice two weird issues though. First, it was called "CampaignRoot", not "SysCampaignRoot", so I renamed it directly in the database. Second and worst of all (probably the only problem), was that the fkLanguageBranch for these entries was "23", which corresponds to "ja-JP" on our site. I found that very weird, as all other system content entries like the trash and root folder had fkLanguageBranchID = 1 (en). (Which is disabled though, our main lang has ID 2, (en-GB)).

Anyways, I changed it. And now the database is repaired!

Here's the script that fixed it:

/* Step 1, find the correct fkContentID */
SELECT TOP 1000 [pkID]
      ,[fkContentTypeID]
      ,[fkParentID]
      ,[ArchiveContentGUID]
      ,[CreatorName]
      ,[ContentGUID]
      ,[VisibleInMenu]
      ,[Deleted]
      ,[ChildOrderRule]
      ,[PeerOrder]
      ,[ExternalFolderID]
      ,[ContentAssetsID]
      ,[ContentOwnerID]
      ,[DeletedBy]
      ,[DeletedDate]
      ,[fkMasterLanguageBranchID]
      ,[ContentPath]
      ,[ContentType]
      ,[IsLeafNode]
  FROM [PiabComTest_EPiServerDB].[dbo].[tblContent]
  WHERE ContentGUID = '48E4889F-926B-478C-9EAE-25AE12C4AEE2'

  /* Step 2, put in the correct fkContentID before running this */

  /*
  Select * from tblWorkContent where fkContentID = 58231
  update tblWorkContent
  set fkLanguageBranchID = 1
  where fkContentId = 58231

  select * from tblContentLanguage where fkContentId = 58231
  update tblContentLanguage
  set fkLanguageBranchID = 1
  where fkContentId = 58231
  */

Could this issue have been related to your earlier version of the same script? I don't have the sources for it anymore. But I did have problems with the exact same script in an earlier update as posted here:

http://world.episerver.com/forum/developer-forum/-EPiServer-75-CMS/Thread-Container/2014/12/episerver-7.19-update-script-bug/

#115282
Jan 13, 2015 10:09
Vote:
 

This has been solved in one of the more recent releases, can't tell which.

#121593
May 14, 2015 14:24
Vote:
 

EPiServer.Commerce.Core 8.7.1 is stable with CMS 7.19.1.0
Install EPiServer.Commerce.Core 8.7.1, It will resolve dependencies

#121594
Edited, May 14, 2015 14:56
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.