Specified cast is not valid

Document created by butlerj Support on Dec 19, 2018
Version 1Show Document
  • View in full screen mode
Database fails to mount in Central Administration or using the NWAdmin.exe and throws "Specified cast is not valid" error.


This is caused by a null or otherwise invalid GUID value present in the dbo.WorkflowInstance table of that specific Nintex Content Database.
  1. Launch SQL Management Studio and establish a connection to your SharePoint/Nintex SQL Server.Execute the following Query against the problematic Database:
    • SELECT DISTINCT SiteId, WebApplicationID FROM WorkflowInstance
  2. You should see a collection of Site Collection ID's and Web Application ID's
  3. Make note of any rows that contain invalid or NULL values.
  4. For each row that has an invalid value, there should be another row that contains the correct set of values that would otherwise match.
  5. You will need to execute the following Query (Adjusted to fit your requirement) to update the invalid row:
    • UPDATE WorkflowInstance SET WebApplicationID='YourGuidHere' WHERE WebApplicationID IS NULL
  6. Retry the attach operation.