Theme Management Exception Thrown and blew away my site

I made a small update to the HeadScript file in my theme yesterday... the site hung and the next thing you know the majority of my theme files were missing and we were getting the "Well That  Was Unexpected" image showing across our site.  The Administration area was still accessible and luckily  I had a couple-days old backup of the theme export I was able to import and bring our site back online, but I want to understand why a simple save nuked my theme and took down our site.

UnknownError

Theme Management: Could not publish theme Theme Type:0c647246-6735-42f9-875d-c8b991fe739b Theme:3fc3f824-83d1-4ec4-85ef-92e206116d49


Added more context
[edited by: Luke R Davidson at 12:08 PM (GMT 0) on Fri, Feb 12 2021]
  • Hi . Yikes, certainly unexpected. Are there any more exceptions logged around the same time as this? There should be. Errors during publishing will attempt to restore, but if the error is due to an underlying IO issue, it could also affect the restore. There will hopefully be at least another exception related to an attempted restore.

  • UnknownException: Theme Management: Could not publish theme Theme Type:0c647246-6735-42f9-875d-c8b991fe739b Theme:3fc3f824-83d1-4ec4-85ef-92e206116d49 (An unexpected error prevented your requested action from completing. The error has been logged for the administrator to review.) ---> UnknownException: An error occurred while publishing a staged theme. The original version has been restored. (An unexpected error prevented your requested action from completing. The error has been logged for the administrator to review.) ---> System.IO.IOException: The directory is not empty.
    
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
       at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
       at Telligent.Evolution.Extensibility.Storage.Providers.Version1.FileSystemFileStorageProvider.Delete(String path)
       at Telligent.Evolution.Platform.Theming.Implementations.ThemeFileService.DeleteAll(Theme theme)
       at Telligent.Evolution.Platform.Theming.Model.StagedTheme.Publish(Int32 userId)
       --- End of inner exception stack trace ---
       at Telligent.Evolution.Platform.Theming.Model.StagedTheme.Publish(Int32 userId)
       at Telligent.Evolution.Components.ThemeOrchestrationService.Publish(StagedThemeItem item)
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiService.PublishTheme(ManagedThemeOptions options)
       --- End of inner exception stack trace ---
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiService.LogError(String message, Exception ex)
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiService.LogError(String message, Exception ex, ManagedThemeOptions options)
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiService.PublishTheme(ManagedThemeOptions options)
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiExtensionService.PublishTheme(IDictionary options)
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
       at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at NVelocity.Runtime.Parser.Node.ASTMethod.Execute(Object o, IInternalContextAdapter context)
       at NVelocity.Runtime.Parser.Node.ASTReference.Execute(Object o, IInternalContextAdapter context)
       at NVelocity.Runtime.Parser.Node.ASTReference.Value(IInternalContextAdapter context)
       at NVelocity.Runtime.Parser.Node.ASTSetDirective.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.ASTBlock.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.ASTIfStatement.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.SimpleNode.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Template.Merge(IContext context, TextWriter writer)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentRenderingService.<>c__DisplayClass38_1.<RenderScriptInternal>b__0()
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentOutputCachingService.Get(ScriptedContentFragment fragment, String cacheKey, Boolean cacheable, Func`1 getRenderedOutput)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentRenderingService.RenderScriptInternal(ScriptedContentFragment contentFragment, NameValueCollection parameters, IPropertyTemplateOptions propertyOptions, String templateName, String internalId, String wrapperId, Boolean throwExceptions, String cacheKey, ScriptLanguage language, String friendlyTemplateName, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentRenderingService.RenderScript(ScriptedContentFragment fragment, NameValueCollection parameters, String fileName, String internalId, String wrapperId, Boolean throwExceptions, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentFileExecutionService.RenderFileInternal(TextWriter writer, Action`3 error, String internalId, String wrapperId, ScriptedContentFragment fragment, String fileName, NameValueCollection parameters, IPropertyTemplateOptions propertyOptions, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentFileExecutionService.RenderRawFile(TextWriter writer, Action`3 error, NameValueCollection executionParameters, NameValueCollection parameters, IPropertyTemplateOptions propertyOptions, ScriptedContentFragment fragment, String fragmentId, String containerType, Guid themeTypeId, Guid themeContextId, Guid themeId, String fileName, String wrapperId, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentFileExecutionService.ExecuteFromState(NameValueCollection state, NameValueCollection executionParameters, TextWriter writer, Action`3 error, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentFileExecutionService.HandleRequest()
       at Telligent.Evolution.ScriptedContentFragments.ScriptedFileHandler.ProcessRequest(HttpContext context)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
       at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
       at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
       at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
       at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
       at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
  • UnknownException: An error occurred while publishing a staged theme. The original version has been restored. (An unexpected error prevented your requested action from completing. The error has been logged for the administrator to review.) ---> System.IO.IOException: The directory is not empty.
    
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive, Boolean throwOnTopLevelDirectoryNotFound, WIN32_FIND_DATA& data)
       at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive, Boolean checkHost)
       at Telligent.Evolution.Extensibility.Storage.Providers.Version1.FileSystemFileStorageProvider.Delete(String path)
       at Telligent.Evolution.Platform.Theming.Implementations.ThemeFileService.DeleteAll(Theme theme)
       at Telligent.Evolution.Platform.Theming.Model.StagedTheme.Publish(Int32 userId)
       --- End of inner exception stack trace ---
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiService.PublishTheme(ManagedThemeOptions options)
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiExtensionService.PublishTheme(IDictionary options)
  • UnknownException: Failed to restore backup during a failed staged theme publication for 3fc3f824-83d1-4ec4-85ef-92e206116d49 (An unexpected error prevented your requested action from completing. The error has been logged for the administrator to review.) ---> System.IO.IOException: The process cannot access the file '\\?\UNC\use1-saas\f2\T\Cfs\hearingfirst\themefiles\f\s\3fc3f82483d14ec485ef92e206116d49\files\hfpromo.less' because it is being used by another process.
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
       at Telligent.Evolution.Extensibility.Storage.Providers.Version1.FileSystemFileStorageProvider.AddUpdateFile(String path, String fileName, Stream contentStream)
       at Telligent.Evolution.Platform.Theming.Implementations.ThemeFileService.InternalSave(Theme theme, ThemeFileType type, String fileName, Stream fileContents)
       at Telligent.Evolution.Platform.Theming.Implementations.ThemeFileService.CopyAll(Theme fromTheme, Theme toTheme)
       at Telligent.Evolution.Platform.Theming.Implementations.ThemeFileService.EnsureFilesAreCommitted(Theme theme)
       at Telligent.Evolution.Platform.Theming.Implementations.ThemeService.Save(Theme theme)
       at Telligent.Evolution.Platform.Theming.Model.StagedTheme.Publish(Int32 userId)
       --- End of inner exception stack trace ---
       at Telligent.Evolution.Platform.Logging.ErrorLogger.Unknown(String internalMessage, Exception innerException)
       at Telligent.Evolution.Platform.Theming.Model.StagedTheme.Publish(Int32 userId)
       at Telligent.Evolution.Components.ThemeOrchestrationService.Publish(StagedThemeItem item)
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiService.PublishTheme(ManagedThemeOptions options)
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiExtensionService.PublishTheme(IDictionary options)
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
       at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at NVelocity.Runtime.Parser.Node.ASTMethod.Execute(Object o, IInternalContextAdapter context)
       at NVelocity.Runtime.Parser.Node.ASTReference.Execute(Object o, IInternalContextAdapter context)
       at NVelocity.Runtime.Parser.Node.ASTReference.Value(IInternalContextAdapter context)
       at NVelocity.Runtime.Parser.Node.ASTSetDirective.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.ASTBlock.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.ASTIfStatement.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.SimpleNode.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Template.Merge(IContext context, TextWriter writer)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentRenderingService.<>c__DisplayClass38_1.<RenderScriptInternal>b__0()
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentOutputCachingService.Get(ScriptedContentFragment fragment, String cacheKey, Boolean cacheable, Func`1 getRenderedOutput)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentRenderingService.RenderScriptInternal(ScriptedContentFragment contentFragment, NameValueCollection parameters, IPropertyTemplateOptions propertyOptions, String templateName, String internalId, String wrapperId, Boolean throwExceptions, String cacheKey, ScriptLanguage language, String friendlyTemplateName, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentRenderingService.RenderScript(ScriptedContentFragment fragment, NameValueCollection parameters, String fileName, String internalId, String wrapperId, Boolean throwExceptions, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentFileExecutionService.RenderFileInternal(TextWriter writer, Action`3 error, String internalId, String wrapperId, ScriptedContentFragment fragment, String fileName, NameValueCollection parameters, IPropertyTemplateOptions propertyOptions, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentFileExecutionService.RenderRawFile(TextWriter writer, Action`3 error, NameValueCollection executionParameters, NameValueCollection parameters, IPropertyTemplateOptions propertyOptions, ScriptedContentFragment fragment, String fragmentId, String containerType, Guid themeTypeId, Guid themeContextId, Guid themeId, String fileName, String wrapperId, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentFileExecutionService.ExecuteFromState(NameValueCollection state, NameValueCollection executionParameters, TextWriter writer, Action`3 error, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentFileExecutionService.HandleRequest()
       at Telligent.Evolution.ScriptedContentFragments.ScriptedFileHandler.ProcessRequest(HttpContext context)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
       at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
       at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
       at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
       at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
       at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
  • UnknownException: Theme Management: Could not publish theme Theme Type:0c647246-6735-42f9-875d-c8b991fe739b Theme:3fc3f824-83d1-4ec4-85ef-92e206116d49 (An unexpected error prevented your requested action from completing. The error has been logged for the administrator to review.) ---> UnknownException: An error occurred while publishing a staged theme and the original could not be fully restored. (An unexpected error prevented your requested action from completing. The error has been logged for the administrator to review.) ---> System.IO.DirectoryNotFoundException: Could not find a part of the path '\\?\UNC\use1-saas\f2\T\Cfs\hearingfirst\stagedthemefiles\2366\f\s\3fc3f82483d14ec485ef92e206116d49\preview\preview-site.png'.
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
       at Telligent.Evolution.Extensibility.Storage.Providers.Version1.FileSystemFileStorageFile.TracedStream..ctor(FileInfo file, String fileStoreKey, String path)
       at Telligent.Evolution.Extensibility.Storage.Providers.Version1.FileSystemFileStorageFile.OpenReadStream()
       at Telligent.Evolution.Platform.Theming.Implementations.ThemeFileService.CopyAll(Theme fromTheme, Theme toTheme)
       at Telligent.Evolution.Platform.Theming.Implementations.ThemeFileService.EnsureFilesAreCommitted(Theme theme)
       at Telligent.Evolution.Platform.Theming.Implementations.ThemeService.Save(Theme theme)
       at Telligent.Evolution.Platform.Theming.Model.StagedTheme.Publish(Int32 userId)
       --- End of inner exception stack trace ---
       at Telligent.Evolution.Platform.Theming.Model.StagedTheme.Publish(Int32 userId)
       at Telligent.Evolution.Components.ThemeOrchestrationService.Publish(StagedThemeItem item)
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiService.PublishTheme(ManagedThemeOptions options)
       --- End of inner exception stack trace ---
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiService.LogError(String message, Exception ex)
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiService.LogError(String message, Exception ex, ManagedThemeOptions options)
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiService.PublishTheme(ManagedThemeOptions options)
       at Telligent.Evolution.Api.Plugins.Administration.ThemeManagement.ThemeManagementUiExtensionService.PublishTheme(IDictionary options)
       at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
       at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at NVelocity.Runtime.Parser.Node.ASTMethod.Execute(Object o, IInternalContextAdapter context)
       at NVelocity.Runtime.Parser.Node.ASTReference.Execute(Object o, IInternalContextAdapter context)
       at NVelocity.Runtime.Parser.Node.ASTReference.Value(IInternalContextAdapter context)
       at NVelocity.Runtime.Parser.Node.ASTSetDirective.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.ASTBlock.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.ASTIfStatement.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Runtime.Parser.Node.SimpleNode.Render(IInternalContextAdapter context, TextWriter writer)
       at NVelocity.Template.Merge(IContext context, TextWriter writer)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentRenderingService.<>c__DisplayClass38_1.<RenderScriptInternal>b__0()
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentOutputCachingService.Get(ScriptedContentFragment fragment, String cacheKey, Boolean cacheable, Func`1 getRenderedOutput)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentRenderingService.RenderScriptInternal(ScriptedContentFragment contentFragment, NameValueCollection parameters, IPropertyTemplateOptions propertyOptions, String templateName, String internalId, String wrapperId, Boolean throwExceptions, String cacheKey, ScriptLanguage language, String friendlyTemplateName, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentRenderingService.RenderScript(ScriptedContentFragment fragment, NameValueCollection parameters, String fileName, String internalId, String wrapperId, Boolean throwExceptions, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentFileExecutionService.RenderFileInternal(TextWriter writer, Action`3 error, String internalId, String wrapperId, ScriptedContentFragment fragment, String fileName, NameValueCollection parameters, IPropertyTemplateOptions propertyOptions, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentFileExecutionService.RenderRawFile(TextWriter writer, Action`3 error, NameValueCollection executionParameters, NameValueCollection parameters, IPropertyTemplateOptions propertyOptions, ScriptedContentFragment fragment, String fragmentId, String containerType, Guid themeTypeId, Guid themeContextId, Guid themeId, String fileName, String wrapperId, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentFileExecutionService.ExecuteFromState(NameValueCollection state, NameValueCollection executionParameters, TextWriter writer, Action`3 error, IDictionary`2 additionalContext)
       at Telligent.Evolution.ScriptedContentFragments.Implementations.ScriptedContentFragmentFileExecutionService.HandleRequest()
       at Telligent.Evolution.ScriptedContentFragments.ScriptedFileHandler.ProcessRequest(HttpContext context)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
       at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
       at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
       at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
       at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
       at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
  • I think that's it.  What happened was we hit "PUblish" on the theme...it hung...when we got back into Administration, about 3/4 of the themefiles were gone and the site was throwing the "Something Unexpected has occurred" image.  Luckily we were able to re-import a backup and get most of our work back and the site came back online.