This article describes an error that can occur when switching projects using the Episerver Project feature.
It will appear in a modal dialog with the following for example.
Failed loading content with the url/uri: epi.cms.contentdata:///10260
Further review into the log and browser console will show these messages.
In the log these items will appear:
"Error: Unable to load /EPiServer/shell/Stores/context/?uri=epi.cms.contentdata%3A%2F%2F%2F4745_22775&epiprojects=4&epieditmode=true&dojo.preventCache=1511963664712 status: 404
at new _317 (https://www.mysite.com/EPiServer/Shell/10.12.1.0/ClientResources/dojo/dojo.js:15:78194)
at _2f1._4f2 [as handleResponse] (https://www.mysite.com/EPiServer/Shell/10.12.1.0/ClientResources/dojo/dojo.js:15:133852)
at XMLHttpRequest._4fe (https://www.mysite.com/EPiServer/Shell/10.12.1.0/ClientResources/dojo/dojo.js:15:134131)"
The exception that is seen in the log when the log is set to "Warn" level, it's the page 4745 that causes this problem to happen.
2017-12-20 04:15:49,994  WARN EPiServer.Cms.Shell.UI.Rest.Internal.CmsContentContextResolver: Content not found. Failed loading content with content link: 10260
EPiServer.Core.PageNotFoundException: Content with id 4745 was not found
at EPiServer.Core.Internal.DefaultContentLoader.Get[T](ContentReference contentLink, LoaderOptions loaderOptions)
at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
at EPiServer.Cms.Shell.UI.Rest.Capabilities.LanguageSettingsCapability.IsCapable(IContent content)
at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at EPiServer.Cms.Shell.UI.Rest.Capabilities.ContentCapabilitiesResolver.GetContentCapabilities(IContent content)
at EPiServer.Cms.Shell.UI.Rest.Internal.CmsContentContextResolver.ToContentDataContext(ContentReference requestedContentReference, IContent content, ContentLanguageInformation languageInformation, Uri requestedUri, UrlBuilder requestedUrl)
at EPiServer.Cms.Shell.UI.Rest.Internal.CmsContentContextResolver.TryResolveUri(Uri uri, ClientContextBase& instance)
In the browser console:
2017-11-29 13:53:22 184.108.40.206 GET /EPiServer/cms/Stores/language/ dojo.preventCache=1511963602308 443 rbroadhuhn 220.127.116.11 Mozilla/5.0+(Windows+NT+6.1;Win64;+x64)+AppleWebKit/537.36(KHTML,+like+Gecko)+Chrome/61.0.3163.100+Safari/537.36 https://www.mysite.com/EPiServer/Cms/ 200 0 0 125
This will make it impossible to publish in those projects.
The reason this issue occurs is the use of projects that seem to live for a long time. In this example there is a reference to a specific version of a page with id 4745 in the project. But the page 4745 have been edited so many times that the page has hit the configured version limit (max 20 versions). This has caused the version that is matched with the project to not exist any more.
This limitation and issue has been identified in CMS-9274 and is being reviewed for a fix at this time. It may be posted to our bug list here at a later time.
To work around the issue until the issue is fixed one could remove all project items referring to that content by running the following SQL statement: (change the ids to match the content and project)
delete from tblProjectItem where fkProjectID = 4 and ContentLinkID = 4745
There might be other pages that share this problem since the project can have a lot more items in this instance. If the same problem occurs again it may have to be repeated for other similar items in project.
As always make a backup of databases before any changes and test thoroughly. This will resolve the issues for now until a fix can be developed to avoid this use case in the future.