PowerShell Universal server crashes with error "Unable to cast object of type 'LiteDB.EmptyPage' to type 'LiteDB.DataPage'. "

PowerShell Universal server crashes with error "Unable to cast object of type 'LiteDB.EmptyPage' to type 'LiteDB.DataPage'. "

Version: 1.4.x
Issue:
An error is thrown when running jobs that states:      
Error executing job 31: Unable to cast object of type 'LiteDB.EmptyPage' to type 'LiteDB.DataPage'.    at LiteDB.PageService.GetPage[T](UInt32 pageID)
This only happens with jobs that write to the output streams. The PowerShell Universal server will crash after writing this error to the log. 
Resolution:
To resolve this issue, you will need to stop the PowerShell Universal server and delete the database.db file in the %ProgramData%\UniversalAutomation folder. When you start PowerShell Universal again, it will recreate the database
Root Cause:
When this error is encountered, the LiteDB reporting and configuration caching database has become corrupt. The table that is responsible for storing the output of jobs is no longer in a valid state. Since configuration of the PowerShell Universal server is stored within PS1 files, your configuration is not lost. This corruption can happen when you have a job that writes an excessive amount of output to the PowerShell output streams. To prevent this error from happening, limit the amount of output that is written to the output stream by using cmdlets like Out-Null. 


    • Related Articles

    • PowerShell Universal Service crashes on startup after an upgrade to 1.4.6

      Version: PowerShell Universal 1.4.6 Issue The PowerShell Universal service will crash with the following error in Event Viewer.  Application: Universal.Server.exe CoreCLR Version: 4.700.19.56402 .NET Core Version: 3.1.0 Description: The process was ...
    • PowerShell Universal crashes after upgrade to 1.5

      Version: 1.5 Issue: The PowerShell Universal service will not start properly when upgrading from 1.4 to 1.5. The following error is shown in the log.  Unhandled exception. System.InvalidCastException: Unable to cast object of type ...
    • ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY when accessing PowerShell Universal

      Version: ​Any Issue: When accessing PowerShell Universal with a Chromium-based browser such as Google Chrome or Microsoft Edge, you can encounter an error when HTTPS is enabled. The error will state ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY.  Root ...
    • PowerShell Universal cmdlets return a 404 over HTTPS

      Version: 1.4 PowerShell Version: Windows PowerShell 5.1 Problem When issue commands against the PowerShell Universal Management API (such as Get-UAJob, Get-UAScript, etc), the cmdlet will return a 404 error. This can happen when running scripts ...
    • IIS: HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure

      Applies to: PowerShell Universal 1.4 or later When configuring PowerShell Universal to run under IIS, you may be presented with an error that states ANCM Out-Of-Process Startup Failure. This error can be presented for a variety of reasons but the ...