Take the community feedback survey now.

Post-move Exception: "Cannot create a command without an existing connection"

Vote:
 

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:

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.

#339685
Jul 15, 2025 10:55
Vote:
 

This doesn't look right.

I bet the product team would appreciate it if you submit your findings on support.optimizely.com.

#339746
Jul 17, 2025 16:10
velijaa - Aug 22, 2025 15:26
Thanks for your reply! I’ve already submitted the findings on support.optimizely.com for the product team. Let’s wait and see how it plays out.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.