aaron.labiosa@nintex.com

Error: "System.InvalidCastException: Specified cast is not valid." When Attaching a Nintex Content Database

Blog Post created by aaron.labiosa@nintex.com Champion on Oct 30, 2014

Products: Nintex Workflow 2013, Nintex Workflow 2010, Nintex Workflow 2007

Summary

The error "Unexpected System.InvalidCastException: Specified cast is not valid.    at Nintex.Workflow.Administration.ContentDatabase.GetSiteIdsAndWebApplicationIdsInDatabase(String connectionString)     at Hhg=.1xg=.InitAttach(Vxg= context)     at Nintex.Workflow.Administration.DatabaseAttacher.Attach()     at Nintex.Workflow.AdministrationPages.DatabaseSettings.btnOk_Click(Object sender, EventArgs e)     at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint).” is thrown in the SharePoint ULS logs.

 

Filtering Criteria:

 

 

ProcessProductCategoryLevel
w3wp.exeSharePoint FoundationRuntimeUnexpected

Symptom

Database fails to mount in Central Administration \ Nintex Workflow Management \ Database Settings.

 

Cause

There is a null or otherwise invalid Guid value present in the dbo.WorkflowInstance table of the Nintex Content Database.

 

A valid Guid value should be of this format: 00000000-0000-0000-0000-000000000000

 

More Information here: GUID structure (Windows)

 

Resolution

  1. Launch SQL Management Studio and establish a connection to your SharePoint/Nintex SQL Server.
  2. Execute the following Query against the problematic Database:
    1. SELECT DISTINCT SiteId, WebApplicationID FROM WorkflowInstance
  3. You should see a collection of Site Collection ID's and Web Application ID's in the 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. You will need to execute the following Query (Adjusted to fit your requirement) to update the invalid row:
    1. UPDATE WorkflowInstance SET WebApplicationID='YourGuidHere' WHERE WebApplicationID IS NULL
  5. Retry the attach operation.

Outcomes