We've identified an issue in Optimizely CMS’s internal handling of content moves using _contentRepository.Move(...), specifically when moving content to the recycle bin (ContentReference.WasteBasket) from a background service or scheduled job.
The content is successfully moved, but immediately after, an exception is thrown:
System.InvalidOperationException: Cannot create a command without an existing connection, you can use DbFactory to create stand-alone command objects
This suggests that some internal follow-up operation—likely a cache update, event propagation, or DB trigger—attempts to create a database command without a valid connection, possibly due to the move being triggered outside of an HTTP request context.
This issue appears to originate from Optimizely CMS internals and not from custom logic.
Stack Trace:
at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor.ExecuteTransaction(Action action)
at EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute[TResult](Func`1 method)
at EPiServer.DataAccess.Internal.ContentSaveDB.Move(Int32 contentLinkID, Int32 destinationLinkID, Boolean archive)
at EPiServer.Core.Internal.DefaultContentProviderDatabase.Move(...)
at EPiServer.Core.Internal.DefaultContentProvider.Move(...)
at EPiServer.Core.Internal.DefaultContentRepository.Move(...)
Environment details:
Optimizely CMS version: 12.33.1
EPiServer.CMS.Core version: 12.22.7
.NET version: .NET 8
Hosted on: Azure
Please let us know if this is a known issue, or if there’s a recommended workaround for safely moving content from background services without triggering this exception.
Description:
We've identified an issue in Optimizely CMS’s internal handling of content moves using _contentRepository.Move(...), specifically when moving content to the recycle bin (ContentReference.WasteBasket) from a background service or scheduled job.
The content is successfully moved, but immediately after, an exception is thrown:
This suggests that some internal follow-up operation—likely a cache update, event propagation, or DB trigger—attempts to create a database command without a valid connection, possibly due to the move being triggered outside of an HTTP request context.
This issue appears to originate from Optimizely CMS internals and not from custom logic.
Stack Trace:
Environment details:
Optimizely CMS version: 12.33.1
EPiServer.CMS.Core version: 12.22.7
.NET version: .NET 8
Hosted on: Azure
Please let us know if this is a known issue, or if there’s a recommended workaround for safely moving content from background services without triggering this exception.