cancel
Showing results for 
Search instead for 
Did you mean: 

Unexpected error: Invalid token for impersonation - it cannot be duplicated error during Run Unity script Action

Prasad_Subraman
Champ in-the-making
Champ in-the-making

We are implementing OnBase 13 for a large government agency. We are receiving the following error when running a unity script from within a workflow action.

Unexpected error: Invalid token for impersonation - it cannot be duplicated.
   at System.Security.Principal.WindowsIdentity.CreateFromToken(IntPtr userToken)
   at System.Security.Principal.WindowsIdentity..ctor(SerializationInfo info)
   at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName)
   at Hyland.Core.Unity.AppDomainManager.getAccessor()
   at Hyland.Core.Unity.AppDomainManager.ExecutionContext.GetExecutor()
   at Hyland.Core.Unity.UnityExecutor.WorkflowExecute(Session session, Int64 operationId, IWorkItemContent content, Element queueElement, PropertyBag sessionPropertyBag, PropertyBag scopedPropertyBag, Int64 batchDocumentsRemaining, Boolean scriptResult)
   at Hyland.Core.Workflow.Module.ExecuteUnityScript(Session session, IWorkItemContent item, Int64 batchDocumentsRemaining, Queue queue, UserProperties scopedPropertyBag, Int64 scriptID, Boolean defaultScriptResult)
   at Hyland.Core.Workflow.Tasks.Actions.RunUnityScript.ExecutionService.InternalExecute(Session session, IWorkItemContent document, Queue queue, Int64 scriptID, Boolean refresh, AddInExecutionArgs args)
   at Hyland.Core.Workflow.Tasks.Actions.RunUnityScript.ExecutionService.ExecuteImpl(Session session, IWorkItemContent content, Queue queue, ITaskConfiguration configuration, ExecutionArgs args)
   at Hyland.Core.Workflow.Tasks.ExecutionServiceBase.Execute(Application app, ExecutionArgs args)
   at Hyland.Core.Workflow.Action.Execute(Session session, IWorkItemContent document, AddInExecutionArgs executionArgs)
Action: 143 'Run Unity script'
Type: Sys_RunUnityScript

The implementation has Unity API Integration Toolkit license. Is this an error due to permissions? Please suggest possible root causes for this error and how we can remedy.

1 REPLY 1

Brian_Koning
Star Contributor
Star Contributor

Hello Prasad,

You are going to want to contact your first line of Technical Support for assistance with this issue. It is not something that should be solved over the public forums as information about the Application Server or Workflow Timer Service configuration will be need.

I can point you in a few directions if you are seeing this problem from an Application Server running your Workflow (as opposed to the Workflow Timer Service).

First, you should take a look at the Windows account configured for impersonation in the Application Server Web.config and make sure everything here is as you intended. Specifically, the credentials themselves should be for a valid Windows user and should be able to login appropriately.

Second, try different combinations of the authentication mechanisms you are using for IIS (Anonymous vs. Windows Authentication). The problem should go away (at least temporarily) when using IIS correctly configured for Anonymous Authentication and with Windows Identity Impersonation disabled.

I have seen this type of problem with Unity Scripts and Workflow before but the way you are describing it puts the problem in a completely different context. Your first line of Technical Support will be able to either assist you directly or put you in contact with someone else who can.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.