U4-1722 - Adding new language gives Cannot insert duplicate key row in object 'dbo.umbracoLanguage' with unique index 'IX_umbracoLanguage_languageISOCode'

Created by Simon Steed 15 Feb 2013, 12:23:01 Updated by Gareth Wright 21 Jun 2018, 12:48:09

Umbraco 6

Added language Japanese to the site Then I select Japanese from the dropdown list on the right Click save and I get the error:

Server Error in '/' Application.

Cannot insert duplicate key row in object 'dbo.umbracoLanguage' with unique index 'IX_umbracoLanguage_languageISOCode'. The statement has been terminated.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Cannot insert duplicate key row in object 'dbo.umbracoLanguage' with unique index 'IX_umbracoLanguage_languageISOCode'. The statement has been terminated.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.umbracoLanguage' with unique index 'IX_umbracoLanguage_languageISOCode'. The statement has been terminated.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) +1753986 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) +5296058 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +558 System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1682 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +269 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite) +1379 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +175 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +205 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +160 Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters) +56 Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) +78 umbraco.DataLayer.SqlHelpers.SqlServer.SqlServerHelper.ExecuteNonQuery(String commandText, SqlParameter[] parameters) +18 umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters) +81

[SqlHelperException: Umbraco Exception (DataLayer): SQL helper exception in ExecuteNonQuery] umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters) +201 umbraco.cms.businesslogic.language.Language.set_CultureAlias(String value) +144 umbraco.settings.editLanguage.save_click(Object sender, ImageClickEventArgs e) +38 System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +115 System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +124 System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034

Language does seem to be installed now but not sure why the error

Comments

Sebastiaan Janssen 21 Feb 2013, 15:06:15

I can't really reproduce this, the only way to get this error if I really quickly press the Save button a few times, but other than that the code looks correct, the list of available languages is filtered to only contain the ones that are not already chosen.

For now, I'll close this issue until this can be reproduced consistently.


Slava 28 Jan 2015, 13:31:21

I got this in 7 version, try to delete 'en-US' and add this language again


Gareth Wright 21 Jun 2018, 12:47:35

We've got this error, trying to add United Kingdom a second time.

Cannot insert duplicate key row in object 'dbo.umbracoLanguage' with unique index 'IX_umbracoLanguage_languageISOCode'. The duplicate key value is (en-GB). The statement has been terminated.


Priority: Normal

Type: Bug

State: Open

Assignee:

Difficulty: Normal

Category: Localization

Backwards Compatible: True

Fix Submitted:

Affected versions: 6.0.0, 7.7.13

Due in version:

Sprint:

Story Points:

Cycle: