The database failed to upgrade. ERROR: The database configuration failed with the following message: Invalid object name 'umbracoLongRunningOperation'

In the process of upgrading from Umbraco 13.15.1 to 17.2.1 and I’m seeing the following error

\[16:53:36 ERR\] Database configuration failed
Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'umbracoLongRunningOperation'.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action\`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action\`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, SqlCommand command, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
   at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData()
   at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource\`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteScalar()
   at Umbraco.Cms.Infrastructure.Persistence.FaultHandling.RetryPolicy.ExecuteAction\[TResult\](Func\`1 func)
   at System.Data.Common.DbCommand.ExecuteScalarAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at NPoco.Database.ExecutionHookAsync\[T\](Func\`2 action, CancellationToken cancellationToken)
   at NPoco.Database.ExecuteScalarHelperAsync(DbCommand cmd, CancellationToken cancellationToken)
   at NPoco.Database.ExecuteScalarAsync\[T\](Sql Sql, CancellationToken cancellationToken)
   at NPoco.Database.ExecuteScalarAsync\[T\](Sql Sql, CancellationToken cancellationToken)
   at Umbraco.Cms.Infrastructure.Persistence.UmbracoDatabaseExtensions.CountAsync(IUmbracoDatabase database, Sql sql)
   at Umbraco.Cms.Infrastructure.Persistence.UmbracoDatabaseExtensions.PagedAsync\[TDto,TResult\](IUmbracoDatabase database, Sql\`1 sql, Int32 skip, Int32 take, Action\`1 sortingAction, Func\`2 mapper)
   at Umbraco.Cms.Infrastructure.Persistence.Repositories.Implement.LongRunningOperationRepository.GetByTypeAsync(String type, LongRunningOperationStatus\[\] statuses, Int32 skip, Int32 take)
   at Umbraco.Cms.Core.Services.LongRunningOperationService.IsAlreadyRunning(String type)
   at Umbraco.Cms.Core.Services.LongRunningOperationService.RunInner\[T\](String type, Func\`2 operation, Boolean allowConcurrentExecution, Boolean runInBackground, CancellationToken cancellationToken)
   at Umbraco.Cms.Infrastructure.HybridCache.DatabaseCacheRebuilder.RebuildAsync(Boolean useBackgroundThread)
   at Umbraco.Cms.Infrastructure.Migrations.MigrationPlanExecutor.RebuildCache()
   at Umbraco.Cms.Infrastructure.Migrations.MigrationPlanExecutor.ExecutePlanAsync(MigrationPlan plan, String fromState)
   at Umbraco.Cms.Infrastructure.Migrations.Upgrade.Upgrader.ExecuteAsync(IMigrationPlanExecutor migrationPlanExecutor, ICoreScopeProvider scopeProvider, IKeyValueService keyValueService)
   at Umbraco.Cms.Infrastructure.Migrations.Install.DatabaseBuilder.UpgradeSchemaAndDataAsync(MigrationPlan plan)
ClientConnectionId:da3844e1-7295-49fb-85a4-386e41837c85
Error Number:208,State:1,Class:16
\[16:53:36 ERR\] Failed DatabaseUpgradeStep, with the message: The database failed to upgrade. ERROR: The database configuration failed with the following message: Invalid object name 'umbracoLongRunningOperation'.

Has anyone come across this issue before? If so, what steps did you take to resolve it?

Hi @sean-dooley-cantarus

Have you tried upgrading to 17.5.3 as that’s the latest version of v17 and most likely contains migration fixes?

From what I can find, the umbracoLongRunningOperation was introduced in v16, so it should be included as you can migrate from LTS to LTS.

If that doesn’t work, you can try going to v16 as an intermediate step to see if that works?

If not, it may be worth raising on the issue tracker if it is reproduceable.

Justin