"Contents parent does not have an identity" error ...
# help-with-umbraco
w
Hi there, I have a custom ContentSavingNotification handler on a U13 site which attempts to create a new node under the one being saved. I am now seeing this handler throw the following error when making the call to CreateAndSave to add the new node - System.InvalidOperationException, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e: Content's parent does not have an identity. There are no results whatsoever for this error when doing a search online - I've been able to find where it gets thrown in the Umbraco source, but I'm no closer to establishing what an identity is, or why my pages are lacking one. https://github.com/umbraco/Umbraco-CMS/blob/ba58c6323c3944b371e9357ccc4019c396b7a44e/src/Umbraco.Core/Models/Entities/TreeEntityBase.cs#L54 This error occurs both when creating a new page under the Home node, or any sub-pages. Does anybody have any further information on this error, why it occurs, and any potential resolutions?
Worth noting that when I disable the custom save handler, the page is created just fine
s
I guess it is because the parent hasn't been saved yet? And therefore there's nothing to create the new node under. Maybe you want to use
ContentSavedNotification
instead?
w
Thanks @Steven (he/him) that's a good idea - will give that a try
That's sorted it, thanks again @Steven (he/him) - the code was migrated from an umbraco v8 site, so maybe there was subtly different functionality in that version or the migration wasn't done right at the time
s
Great to hear!
s
Ah interesting!
2 Views