This doesn't look right.
I bet the product team would appreciate it if you submit your findings on support.optimizely.com.
Hi,
Did you get a resolution? I'm seeing similar behavior in my own background tasks.
Best regards
F
I found CMS-46455 in the EPiServer.CMS.Core 12.22.9 release notes. It addresses background tasks not running in an isolated context, which could cause conflicts with database contexts and parallel tasks.
The original report was using EPiServer.CMS.Core 12.22.7, so that fix was not included in the reported environment.
However, the release note does not specifically mention IContentRepository.Move(), ContentReference.WasteBasket, or the exact “Cannot create a command without an existing connection” exception. Therefore, CMS-46455 should only be considered a potentially related fix, not a confirmed resolution for this issue.
It would be worth upgrading to the latest compatible CMS version and retesting. If the exception remains, the Optimizely support case would be the best source for confirming the exact bug reference and resolution.
Release notes:
https://support.optimizely.com/hc/en-us/articles/42412167768333-2025-Optimizely-CMS-12-release-notes
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.