Error about string or binary data being truncated when logging in to Sitecore XP


Description

The following error might appear when several admin users are logged in to Sitecore XP:

 [SqlException (0x80131904): String or binary data would be truncated.
The statement has been terminated.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +277
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +764
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4243
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) +513
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) +3382
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +710
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) +540
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +391
   Sitecore.Data.DataProviders.Sql.DataProviderCommand.ExecuteNonQuery() +75

[DataException: Error executing SQL command:  INSERT INTO [Properties] (   [Key], [Value] ) VALUES (   @name, @value )]

[Exception: String or binary data would be truncated.
The statement has been terminated.]
   Sitecore.Data.DataProviders.Sql.DataProviderCommand.ExecuteNonQuery() +286
   Sitecore.Data.DataProviders.Sql.<>c__DisplayClass33_0.<Execute>b__0() +73
   Sitecore.Data.DataProviders.NullRetryer.Execute(Func`1 action, Action recover) +287
   Sitecore.Data.Properties.SqlPropertyStore.SetStringValueCore(String prefixedName, String value) +589
   Sitecore.Data.Properties.PropertyStore.SetStringValue(String name, String value) +76
   Sitecore.Web.Authentication.DefaultTicketManager.CreateTicket(String userName, String startUrl, Boolean persist) +558
   Sitecore.Pipelines.LoggedIn.Ticket.Process(LoggedInArgs args) +104

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +128
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +142
   Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj) +89
   Sitecore.Nexus.Pipelines.NexusPipelineApi.Resume(PipelineArgs args, Pipeline pipeline) +294
   Sitecore.Pipelines.Pipeline.Start(PipelineArgs args, Boolean atomic) +167
   Sitecore.sitecore.login.Default.LoggedIn() +292
   Sitecore.sitecore.login.Default.LoginClicked(Object sender, EventArgs e) +76
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +141
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +150
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5445

Solution

To resolve the issue, download and install the patch or the latest cumulative hotfix compatible with the affected product version: