Conversion errors in the Jira Align Connector log when Jira Sprints are being created or updated.
Summary
This article contains instructions on how to troubleshoot the conversion errors such as:
The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.\r\nThe statement has been terminated
Which can be seen in the Jira Connector logs.
Environment
Jira Align Self-Hosted
Diagnosis
The Jira Align sprints are not being created or accordingly updated with the correct dates of the corresponding Jira sprints.
The Jira Connector logs under <logs_dir>/<CustomerName>-Jira-<JiraId>-<date>.log are full of fatal and error messages like the one below:
"RenderedMessage": "UpdateSprints:JiraSprints:AgileCraftIterationMapping:board: 2035 sprint: 14954 jSprintDetails: \"{\\\"id\\\":14954,\\\"state\\\":\\\"closed\\\",\\\"name\\\":\\\"BTM Sprint 7.5\\\",\\\"startDate\\\":\\\"2022-06-01T14:00:00.000+02:00\\\",\\\"endDate\\\":\\\"2022-06-21T18:00:00.000+02:00\\\",\\\"completeDate\\\":\\\"2022-06-21T17:09:01.325+02:00\\\",\\\"originBoardId\\\":2035,\\\"self\\\":\\\"https://jira-instance.atlassian.net/rest/agile/1.0/sprint/14954\\\",\\\"status-code\\\":null,\\\"stack-trace\\\":null}\"", "Exception": "System.Data.SqlClient.SqlException (0x80131904): The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.\r\nThe statement has been terminated.\r\n at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)\r\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)\r\n at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)\r\n at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()\r\n at System.Data.SqlClient.SqlDataReader.get_MetaData()\r\n at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)\r\n at 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)\r\n at 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)\r\n at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)\r\n at System.Data.SqlClient.SqlCommand.ExecuteScalar()\r\n at Integration.DataAccess.ResilientSqlData.<>c__DisplayClass4_0`1.<ExecuteScalar>b__0()\r\n at Polly.Policy.<>c__DisplayClass114_0`1.<Execute>b__0(Context ctx, CancellationToken ct)\r\n at Polly.Retry.RetryEngine.Implementation[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Action`4 onRetry, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider)\r\n at Polly.Retry.RetryPolicy.Implementation[TResult](Func`3 action, Context context, CancellationToken cancellationToken)\r\n at Polly.Policy.Execute[TResult](Func`3 action, Context context, CancellationToken cancellationToken)\r\n at Polly.Policy.Execute[TResult](Func`1 action)\r\n at Integration.DataAccess.ResilientSqlData.ExecuteScalar[T](String connectionString, String sql, SqlParameter[] parameters, Nullable`1 commandTimeout)\r\n at AgileCraft_Jira.AgileCraft.CreateACSprint(Agile_Sprint sprint, Int32 sequence, Int32 boardID, ACTeam acTeam, Int32 bufferDays) in C:\\projects\\alignintegration\\Connectors\\JiraServiceProduction\\AgileCraft_Jira\\AgileCraft.cs:line 14079\r\n at AgileCraft_Jira.AgileCraft.UpdateSprints(JiraManager manager, Int32 boardID, Agile_Sprint sprint, Int32 sequence, ACTeam acTeam, Int32 bufferDays, Int32 allowACSprintCreation, String projectName) in C:\\projects\\alignintegration\\Connectors\\JiraServiceProduction\\AgileCraft_Jira\\AgileCraft.cs:line 2138\r\nClientConnectionId:705ef105-88fa-4ae3-ab19-283676311036\r\nError Number:242,State:3,Class:16",
Cause
The current Windows System-locale settings, where the Jira Connector service runs, are set to use a different format than English (United States) under Control Panel > Region.
For example by going to the date and time section of the Windows taskbar:
Or from a Windows PowerShell:
Solution
1- Set the Region Format to use English (United States) for the Windows local system or for the user running the Jira Connector Service.
2- Copy the settings to the Welcome screen and system accounts:
Format change: | Administrative settings copy: |
---|---|
⚠ Without copying the settings the change is not taken into account. |
3- Once this is done, stop and start the Jira Connector service so that the changes are taken into account.
⚠ You may have to reboot the machine for the settings to take full effect.