Workflow trace error

When a workflow trace is turned on, sometimes it ends with the following error. The OrigamTraceWorkflowStep is most probably created earlier than the parent OrigamTraceWorkflow record.

2022-09-08 06:32:48,721 [23] ERROR Origam.DA.Service.AbstractSqlDataService - Update failed
System.Data.SqlClient.SqlException (0x80131904): The INSERT statement conflicted 
with the FOREIGN KEY constraint "FK_AsapTraceWorkflowStep_refAsapTraceWorkflowId_AsapTraceWorkflow". 
The conflict occurred in database "xxx", table "dbo.OrigamTraceWorkflow", column 'Id'.
The statement has been terminated.
   at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
   at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
   at Origam.DA.Service.AbstractSqlDataService.ExecuteUpdate(DataStructureQuery query, String transactionId, UserProfile profile, DataStructure ds, IDbTransaction transaction, IDbConnection connection, ArrayList deletedRowIds, DataTable changedTable, DataRowState rowState, DataStructureEntity entity, Int32 rowCount, Boolean forceBulkInsert) in D:\a\1\s\backend\Origam.DA.Service\AbstractSqlDataService.cs:line 851
   at Origam.DA.Service.AbstractSqlDataService.<>c__DisplayClass23_2.<UpdateData>b__0() in D:\a\1\s\backend\Origam.DA.Service\AbstractSqlDataService.cs:line 563
   at Origam.DA.Service.Profiler.ExecuteAndTakeLoggingAction(DataStructureEntity entity, Action`2 loggingAction, Action actionToExecute) in D:\a\1\s\backend\Origam.DA.Service\AbstractSqlDataService.cs:line 2682
   at Origam.DA.Service.AbstractSqlDataService.UpdateData(DataStructureQuery query, IPrincipal userProfile, DataSet dataset, String transactionId, Boolean forceBulkInsert) in D:\a\1\s\backend\Origam.DA.Service\AbstractSqlDataService.cs:line 553

That means OrigamTracwWorkflow table entry was not created but trace step wants to be stored anyway. Looks like e.g. a sub workflow or a single step is set to be traced but the workflow did not start tracing.