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
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. 
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 ...
    • KB0025 - Universal Server fails to start automatically

      Applicability This article applies to PowerShell Universal (Kestrel version*) running on Windows. If you have PowerShell Universal running under IIS or another OS then this article does not apply. Symptom Even though the PowerShell Universal service ...
    • KB0042 - HTTP Error 500.19 - internal server error 0x8007000d

      Problem When trying to browse your instance of PowerShell Universal (running on IIS under Windows Server via the ZIP install of PowerShell Universal [1] ) you receive HTTP Error 500.19 - Internal Server Error with error code 0x8007000d Cause You may ...
    • KB0021 - Unable to update Dashboard Pages in PowerShell Universal 3.6.4

      Purpose Due to an issue with the client-side application in PowerShell Universal 3.6.4, you may experience a problem updating page content. When clicking the Save button, a toast message would be shown that states that a 400 HTTP error had occurred. ...