Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Meni 277 posts 534 karma points
    Jul 22, 2024 @ 03:43
    Meni
    0

    Error after upgrading from U13 to U14.1: An item with the same key has already been added. Key: title

    Hello.

    Last week I upgraded my website from U13 to U14.1

    The upgrade went smooth.

    But, when I tried to add a new post (item) , I got this error. And since last week I can't update my website. It's an online magazine and I can't add news items.

    The website is up and running, but I just can't add new items.

    An item with the same key has already been added. Key: title
    A fatal server error occurred. If this continues, please reach out to your 
    administrator.
    

    The error above I got in the back office every time I trying to add new item to the tree (new post, etc.).

    The following error I got in the console:

       POST https://www.xxxx.xxx/umbraco/management/api/v1/document/validate 500 (Internal Server Error)
       POST https://www.xxxx.xxx/umbraco/management/api/v1/document 500 (Internal Server Error)
    

    Payload for api/v1/document/validate:

    {"id":"09ce9871-2e82-45e9-bb4f-6ceed354a69a","parent":{"id":"e0dd84d0-1629-4126-bfe4-079e7c0083d5"},"documentType":{"id":"69f74238-1298-35a2-a4bd-fd33c2596340"},"template":null,"values":[{"culture":null,"segment":null,"alias":"title","value":"test123"},{"culture":null,"segment":null,"alias":"opliCategory","value":["Quantum Physics and Quantum Computing"]},{"culture":null,"segment":null,"alias":"articleText","value":{"markup":"","blocks":{"layout":{},"contentData":[],"settingsData":[]}}}],"variants":[{"state":null,"name":"test","publishDate":null,"createDate":null,"updateDate":null,"culture":null,"segment":null}]}
    

    Response:

    {
    "type": "Error",
    "title": "No property editor found by alias Umbraco.MediaPicker",
    "status": 500,
    "detail": "   at Umbraco.Cms.Core.Services.PropertyValidationService.ValidatePropertyValue(IPropertyType propertyType, Object postedValue)\r\n   at Umbraco.Cms.Core.Services.ContentValidationServiceBase`1.ValidateProperty(ContentEditingModelBase contentEditingModelBase, IPropertyType propertyType, String culture, String segment)\r\n   at Umbraco.Cms.Core.Services.ContentValidationServiceBase`1.HandlePropertiesValidationAsync(ContentEditingModelBase contentEditingModelBase, TContentType contentType)\r\n   at Umbraco.Cms.Core.Services.ContentValidationService.ValidatePropertiesAsync(ContentEditingModelBase contentEditingModelBase, IContentType contentType)\r\n   at Umbraco.Cms.Core.Services.ContentEditingServiceBase`4.ValidatePropertiesAsync(ContentEditingModelBase contentEditingModelBase, TContentType contentType)\r\n   at Umbraco.Cms.Core.Services.ContentEditingServiceBase`4.ValidatePropertiesAsync(ContentEditingModelBase contentEditingModelBase, Guid contentTypeKey)\r\n   at Umbraco.Cms.Core.Services.ContentEditingService.ValidateCulturesAndPropertiesAsync(ContentEditingModelBase contentEditingModelBase, Guid contentTypeKey)\r\n   at Umbraco.Cms.Core.Services.ContentEditingService.ValidateCreateAsync(ContentCreateModel createModel)\r\n   at Umbraco.Cms.Api.Management.Controllers.Document.ValidateCreateDocumentController.<>c__DisplayClass3_0.<<Validate>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Api.Management.Controllers.Document.CreateDocumentControllerBase.HandleRequest(CreateDocumentRequestModel requestModel, Func`1 authorizedHandler)\r\n   at Umbraco.Cms.Api.Management.Controllers.Document.ValidateCreateDocumentController.Validate(CancellationToken cancellationToken, CreateDocumentRequestModel requestModel)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\r\n   at Umbraco.Cms.Web.Common.Middleware.BasicAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Api.Management.Middleware.BackOfficeExternalLoginProviderErrorMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\r\n   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\\projects\\dotnet\\src\\MiniProfiler.AspNetCore\\MiniProfilerMiddleware.cs:line 112\r\n   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Web.Common.Middleware.PreviewAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestLoggingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)",
    "instance": "InvalidOperationException"
    }
    

    Payload for /api/v1/document:

    {"id":"09ce9871-2e82-45e9-bb4f-6ceed354a69a","parent":{"id":"e0dd84d0-1629-4126-bfe4-079e7c0083d5"},"documentType":{"id":"69f74238-1298-35a2-a4bd-fd33c2596340"},"template":null,"values":[{"culture":null,"segment":null,"alias":"title","value":"test123"},{"culture":null,"segment":null,"alias":"opliCategory","value":["Quantum Physics and Quantum Computing"]},{"culture":null,"segment":null,"alias":"articleText","value":{"markup":"","blocks":{"layout":{},"contentData":[],"settingsData":[]}}}],"variants":[{"state":null,"name":"test","publishDate":null,"createDate":null,"updateDate":null,"culture":null,"segment":null}]}
    

    Response:

    {
    "type": "Error",
    "title": "An item with the same key has already been added. Key: title",
    "status": 500,
    "detail": "   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)\r\n   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)\r\n   at System.Linq.Enumerable.ToDictionary[TSource,TKey](IEnumerable`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)\r\n   at Umbraco.Cms.Core.Services.ContentEditingServiceBase`4.TryGetAndValidateContentType(Guid contentTypeKey, ContentEditingModelBase contentEditingModelBase, ContentEditingOperationStatus& operationStatus)\r\n   at Umbraco.Cms.Core.Services.ContentEditingServiceBase`4.MapCreate[TContentCreateResult](ContentCreationModelBase contentCreationModelBase)\r\n   at Umbraco.Cms.Core.Services.ContentEditingService.CreateAsync(ContentCreateModel createModel, Guid userKey)\r\n   at Umbraco.Cms.Api.Management.Controllers.Document.CreateDocumentController.<>c__DisplayClass4_0.<<Create>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Api.Management.Controllers.Document.CreateDocumentControllerBase.HandleRequest(CreateDocumentRequestModel requestModel, Func`1 authorizedHandler)\r\n   at Umbraco.Cms.Api.Management.Controllers.Document.CreateDocumentController.Create(CancellationToken cancellationToken, CreateDocumentRequestModel requestModel)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)\r\n   at Umbraco.Cms.Web.Common.Middleware.BasicAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Api.Management.Middleware.BackOfficeExternalLoginProviderErrorMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)\r\n   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)\r\n   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\\projects\\dotnet\\src\\MiniProfiler.AspNetCore\\MiniProfilerMiddleware.cs:line 112\r\n   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Web.Common.Middleware.PreviewAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestLoggingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)\r\n   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.InterfaceMiddlewareBinder.<>c__DisplayClass2_0.<<CreateMiddleware>b__0>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)",
    "instance": "ArgumentException"
    }
    

    Any idea how I can I continue update my website ??

    I tried to downgrade back to U13 (locally), but keep getting errors:

    The migration plan does not support migrating from state "{A385C5DF-48DC-46B4-A742 ... .... ...
    

    So now I'm stuck with 14.1, can't add news items, and can't downgrade to U13 ...

    Any idea?

    Please help.

    Appreciate.

    Thanks.

  • Meni 277 posts 534 karma points
    Jul 25, 2024 @ 20:47
    Meni
    0

    Following some old answers here and in stackoverflow I ran the following command in the DB:

    SELECT cct.[alias], [contentTypeId], cpt.[alias], count(cpt.[Alias]) FROM [cmsPropertyType] cpt JOIN [cmsContentType] cct on cpt.contentTypeId = cct.nodeid GROUP BY cct.[alias], [contentTypeId], cpt.[alias] HAVING COUNT(cpt.[alias]) > 1
    

    and got this: enter image description here

    enter image description here

    What now? what do I need to do now in order to fix the issue?

    Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft