Umbraco-CMS icon indicating copy to clipboard operation
Umbraco-CMS copied to clipboard

Issue when enabling Check box property as variant: The existing DocumentCultureVariationDto was not found for node XXXX and language X

Open HalldorLyngmo opened this issue 3 years ago • 30 comments
trafficstars

Which exact Umbraco version are you using? For example: 9.0.1 - don't just write v9

Umbraco 8.17.1

Bug summary

Here's the scenario, I've got a doctype that has "Allow vary by culture" enabled. There is one property, Check box, that doesn't have variants enabled so I decide to change that.

Save the Check box property type, everything is fine. Save the document type and there is an exception: The existing DocumentCultureVariationDto was not found for node 1065 and language 1

On the project, I've got two languages:

  • English with id 1 (default)
  • Danish with id 2

Node 1065 has only been saved in one language, Danish. If I create an English version and save it. Then go back to the document type and change the property to a variant, I can save the document type without an exception

Specifics

The issue seems to originate from the Checkbox property value being saved in the DB when it shouldn't. This value should be coming from the default language version of the node. But since the property has the value 0 by default it still gets saved.

image

Then when changing the property to be a variant it tries to convert it to the default language but since there isn't a Default language version of the node it fails to find the correct information.

Exception Details
Umbraco.Core.Exceptions.PanicException: The existing DocumentCultureVariationDto was not found for node 1066 and language 1

at Umbraco.Core.Persistence.Repositories.Implement.ContentTypeRepositoryBase`1.RenormalizeDocumentEditedFlags(IReadOnlyCollection`1 propertyTypeIds, IReadOnlyCollection`1 contentTypeIds)
   at Umbraco.Core.Persistence.Repositories.Implement.ContentTypeRepositoryBase`1.MovePropertyTypeVariantData(IDictionary`2 propertyTypeChanges, IEnumerable`1 impacted)
   at Umbraco.Core.Persistence.Repositories.Implement.ContentTypeRepositoryBase`1.PersistUpdatedBaseContentType(IContentTypeComposition entity)
   at Umbraco.Core.Persistence.Repositories.Implement.ContentTypeRepository.PersistUpdatedItem(IContentType entity)
   at Umbraco.Core.Cache.FullDataSetRepositoryCachePolicy`2.Update(TEntity entity, Action`1 persistUpdated)
   at Umbraco.Core.Services.Implement.ContentTypeServiceBase`3.Save(TItem item, Int32 userId)
   at Umbraco.Web.Editors.ContentTypeControllerBase`1.PerformPostSave[TContentTypeDisplay,TContentTypeSave,TPropertyType](TContentTypeSave contentTypeSave, Func`2 getContentType, Action`1 saveContentType, Action`1 beforeCreateNew)
   at Umbraco.Web.Editors.ContentTypeController.PostSave(DocumentTypeSave contentTypeSave)
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__15.MoveNext()

Steps to reproduce

Umbraco project running latest v8 (not tested on v9 yet)

  1. Create a document type that's a variant

  2. Create one check box (true/false) property and make it non-variant image

  3. Add a second language to the project image

  4. Create a node with the document type in the second language which should not be the default. image

  5. Go back to the document type and change the property to be a variant image

  6. Then save the document type and there should be an exception:

Expected result / actual result

Desired result

When you save the node in the non-default language it should not save the checkbox property value in the DB. This would be consistent with most other properties from what I can see. Thus eliminating a potential issue with converting the value when the property is made variant

Expected Result

No exception when saving the document type

Actual Result

Exception because of inconsistent behavior with property values in the DB.


This item has been added to our backlog AB#15943

HalldorLyngmo avatar Dec 17 '21 11:12 HalldorLyngmo

Hey @HalldorLyngmo

Thanks for all the info here 😁 I'll reproduce and label. Lots to work with.

emma

emma-hq avatar Dec 23 '21 10:12 emma-hq

I can repro on 8.17 and 8.13 but not on 8.11 so something seems to have happened along the way.

This is the short repro, the important part that tripped me up for a bit was to create the node with the non-default language only, so it "inherits" the checkbox from the default language (which.. doesn't exist).

https://user-images.githubusercontent.com/304656/147926510-7dc248cc-98bd-4736-9ee0-17eec417a7f4.mp4

nul800sebastiaan avatar Jan 03 '22 11:01 nul800sebastiaan

The same error occurs in v9.1.0.

nul800sebastiaan avatar Jan 03 '22 11:01 nul800sebastiaan

We urgently need a fix for this. Is there a workaround to reset the faulty values so that we can adjust the document-types?

nielslynggaard avatar Feb 01 '22 12:02 nielslynggaard

Also; The same error persists on the "Slider" datatype.

nielslynggaard avatar Feb 01 '22 13:02 nielslynggaard

Hi @nielslynggaard it should be possible to change the property back to being invariant as a workaround.

If it's a Cloud project and the above doesn't help, then please reach out to our support and we'll take a closer look 🙂

HalldorLyngmo avatar Feb 08 '22 09:02 HalldorLyngmo

Yeah, sorry if I was unclear. The issue we were facing was the other way around. We had a few properties that weren't setup to vary by culture and we couldn't change that. The solution for us was to delete the properties on the live environment and re-create the same properties but with vary by culture on.

nielslynggaard avatar Feb 08 '22 09:02 nielslynggaard

@nul800sebastiaan

I can repro on 8.17 and 8.13 but not on 8.11 so something seems to have happened along the way.

I think this change might have inadvertently introduced the issue - https://github.com/umbraco/Umbraco-CMS/issues/10572

HalldorLyngmo avatar Feb 15 '22 14:02 HalldorLyngmo

Did anyone ever discover a fix for this? Or at least a temporary solution so I can fix some broken doc types we have? We're on the latest Umbraco 9.3.1 but the project was originally started on 9 beta. In my case I'm trying to make some properties non vary by culture.


The existing DocumentCultureVariationDto was not found for node 4143 and language 2

Exception Details Umbraco.Cms.Core.Exceptions.PanicException, Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null: The existing DocumentCultureVariationDto was not found for node 4143 and language 2


And if i try to entire doctype non vary by culture I get a similar error:


The existing DocumentCultureVariationDto was not found for node 4031 and language 1

Exception Details Umbraco.Cms.Core.Exceptions.PanicException, Umbraco.Core, Version=9.3.1.0, Culture=neutral, PublicKeyToken=null: The existing DocumentCultureVariationDto was not found for node 4031 and language 1


I can delete the property and add a new one with the same name and the doc type will save ok but then I lose the data :(

smarshallsay avatar Mar 08 '22 16:03 smarshallsay

I have the same problem on umbraco 8.16.0 . I do not have any checkboxes on the doc type. It contains only the following data types:

  • Textstring
  • RTE
  • MultiUrlPicker
  • EmailAddress

craigFactory73 avatar Mar 25 '22 14:03 craigFactory73

I can add that the problem i also occurring on Umbraco 8.18.3. Trying to change a MultiUrlPicker on a composition (its the only prop on the comp)

My work around was to delete the node referenced in the error. But of course not a great solution :)

TheBekker avatar Sep 30 '22 09:09 TheBekker

Any update on this issue? I'm running in to it right now and it blocks an update for our client

FransdeJong avatar Dec 08 '22 14:12 FransdeJong

Experiencing same on 11.0.0

enemyss avatar Jan 03 '23 12:01 enemyss

I can reproduce this on V10 as well. I don't think this is tied to any specific property editor but rather to the content itself.

A possible workaround might be to save the affected content nodes in their missing languages. Not necessarily a great workaround, and also rather tedious if the problem is widespread, but nevertheless may be a workaround to prevent data loss.

I'll see if we can push this into one of the upcoming sprints. In the mean time, if someone wants to have a crack at it, please feel free to give it a go. I'll mark it as up for grabs.

kjac avatar Jan 12 '23 16:01 kjac

I was just able to bypass this on 8.16 by doing a manual SQL update to the property rows.

Ex:
update [umbracoPropertyData] set languageId = 1 where propertyTypeId = @propTypeId

I could now save the doctype with the property as a variant.
After this, all content of non-default language was unpublished and unavailable in the cache.
Clicking from the bottom and up under Settings\Published Status seemed to make everything OK after that.
(I guess in essence rebuilding the DB-cache)

To early to mention any consequences, but so far so good. 🙈

lars-erik avatar Feb 22 '23 13:02 lars-erik

We are seeing this issue as well on an Umbraco 11.2.0 installation. It would be nice to see a solution implemented to this soon, we are closing in on 1½ years for this bug to run 🙈

sniffdk avatar Apr 25 '23 09:04 sniffdk

@lars-erik did you ever run into any unforeseen consequences here by any chance? 😅

sniffdk avatar May 15 '23 09:05 sniffdk

@lars-erik did you ever run into any unforeseen consequences here by any chance? 😅

Not yet. 😄🤞

lars-erik avatar May 15 '23 10:05 lars-erik

@lars-erik did you ever run into any unforeseen consequences here by any chance? 😅

Not yet. 😄🤞

Good to hear, will need to try the same workaround soon then 🤞 thx 😃

sniffdk avatar May 15 '23 11:05 sniffdk

Had this issue as well. Wanted to set a property to vary by culture, which wasn't before and many nodes already existed. In my case there was one node which blocked saving the property to vary by culture on the specific content type. Figuered out, that there was no default language version saved for this node. So added a default language version for this node. After that I was able to save the property to vary by culture on the specific content type without any issues.

marwaldv avatar Sep 11 '23 07:09 marwaldv

Same here, basically about to adjust a composable property to allow vary by culture on an existing site with quite a bit of content. Sounds like a common scenario so a little surprised this bug still exists.

ksolberg avatar Sep 28 '23 06:09 ksolberg

Anyone found a solution for this ? Stille a issue in Umbraco 12.3.5

thomashdk avatar Jan 22 '24 09:01 thomashdk

Still a issue in Umbraco 13.1.1

Anyone found a workaround ?

thomashdk avatar Feb 13 '24 21:02 thomashdk

update [umbracoPropertyData] set languageId = 1 where propertyTypeId = @propTypeId

@lars-erik how did you find what propertyfield caused the issue ? :)

thomashdk avatar Feb 13 '24 22:02 thomashdk

@lars-erik how did you find what propertyfield caused the issue ? :)

TBH I don't even remember doing it, but I imagine I may have queried the cmsPropertyData table and looked for languageId = null.

lars-erik avatar Feb 15 '24 10:02 lars-erik

Same here Umbraco v8.18.12

khraibani avatar Feb 19 '24 17:02 khraibani

We're experiencing the same issue in V11. Not sure running a SQL script against a database in production would be safe.

garpunkal avatar Feb 29 '24 15:02 garpunkal

This is still an issue, is anyone from Umbraco looking at this ? @nul800sebastiaan ?

gardarthorsteins avatar Mar 22 '24 15:03 gardarthorsteins

update [umbracoPropertyData] set languageId = 1 where propertyTypeId = @propTypeId

@lars-erik how did you find what propertyfield caused the issue ? :)

I have this issue again... In V13.

Now when I run the update I get this error:

Cannot insert duplicate key row in object 'dbo.umbracoPropertyData' with unique index 'IX_umbracoPropertyData_VersionId'. The duplicate key value is (33000, 319, 2, <NULL>).

Really strange.. Last I had the issue I could run the update just fine..

Disable the index or delete it works...

But are not able to create the index again, then it's giving me the same error

thomashdk avatar Aug 12 '24 18:08 thomashdk

We're experiencing the same issue in V11. Not sure running a SQL script against a database in production would be safe.

Did you find a workaround ?

thomashdk avatar Aug 19 '24 11:08 thomashdk