When a workflow is started on item creation by email or Nintex Live Form, the workflow might fail with the following error:
Failed on start (retrying)
After a few minutes the workflow then starts and completes correctly.
The following error will appear in the ULS Logs: Load Workflow Class: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
This issue is caused by the topology of the farm. When an item is created by either an email or a Nintex Live Form, the workflow will try to run on the server that is configured to run the timer jobs for those services. This causes the above problem because the app Server does not have access to the Workflow class, so it returns the above error.After the error is returned the Workflow is persisted to the Sharepoint Content Database to be retried. The workflow then runs properly at the next run of the Workflow Timer Job because the job is runs on a WFE which has access to the class.