UiPath CE Job Faulted : Invalid handle

( Installer: Exe, CE 2019.7.0 )

Hello,

I am able to run a workflow from platform.uipath.com whitout any problem when a remote connection desktop is open on the target machine, but i got an error as soon as is it closed.

System.ComponentModel.Win32Exception (0x80004005): The handle is invalid
at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at UiPath.Vision.UiImage.FromScreenRegion(Rectangle region)
at UiPath.Core.Image…ctor(Region screenRegion)

RemoteException wrapping UiPath.Core.ImageOperationException: System.ComponentModel.Win32Exception (0x80004005): The handle is invalid


The workflow (ok):

  1. Open website, login, download .ica, logoff, close
  2. Open .ica (wait image disapear on loading citrix app windows), click 3 image on the opened citrix (navigation and export file)
  3. Wait preparation and transfert of file (4min), close citrix app
  4. Upload file on FTP, remove local file

I have used a remote desktop connection from my workstation to the target Windows Server 2012R2, then installed UiPath Studio 2019.7.0 CE + robot from .exe, user is local admin of target server.
I encountered no real issues related to the workflow or the dev.
I got problem setting up the robot to behave as expected.

The error is always on the first “click image” activity after launching the citrix app.
I got no issue launching the job from Orchestrator when the remote desktop connection is Open (from workstation to target server) ; success.
I got an error launching the job from Orchestrator when the remote desktop connection is Closed (user not logged off, just disconnected) ; error : the handle is invalid.
When reconnecting the rdp i got the citrix app opened in the first expected state, just before the click image (half of the workflow done).


I have simplified the workflow to only 1 activty, the first “click image” on the citrix app, i have the same behavior.
RDP Opened on target : success.
RPD Closed on target : faulted : The handle is invalid.

I’ve done some search:
UiPath Robt: Robot is not working when remote desktop disconnected (not resolved)
Frequently Encountered Orchestrator Errors

This error is displayed in the following cases:
A. Projects containing UI Automation - when a RDP connection already exists in the background (minimized).

I tried (with and without screenX/Y set to 1920*1080 in the orchestrator robot settings):

  • development licence + rdp on : success
  • develoment licence + rdp off : faulted
  • development licence + user logged off : robot not connected to orchestrator
  • unattended licence + rdp on : success
  • unattended licence + rdp off : faulted
  • unattended licence + user logged off : robot not connected to orchestrator

I went around the .msi installer, with enterprise trial 2019.4.4 and the robot service, without more success. I had some sort of conflict between the 2 UiPath instances after, some studio crashes when executing robot, ended up uninstalling both UiPath instances, reboot and reinstall 2019.7.0 CE, back to start.


I’d like to be able to run (manual or sheduled) my job (single "click image " activity) from orchestrator, when the remote desktop connection is closed or when the user is logged off (getting around error : “The handle is invalid”).
Can you help me figure it out ?

Kind Regards,
Ulysse

Same we are facing please can you please help us?

Has anyone found a solution?
We are encountering the same issue with Orchestrator Version 2021.10.2

Thank you

I’ve brought this problem to the UiPath Support and they were able to help!

According to the issue description I would recommend the below approach for troubleshooting:

  1. First thing is to sign out/log out the existing Robot user profile when closing the RDP connection (if RDP is being used), and not just disconnecting this. This will ensure the session gets created when the Robot logs in to execute the job, rather than linking itself to the existing session, which was been disconnected. The existing session which has been disconnected, would have lost it’s UI (when the RDP window is closed) due to which, the time out occurs on UI interactions.
  2. On the Orchestrator’s Robot runtime settings screen, ensure to enable “LoginToConsole” and set the option to “No”. Please ensure to enable and set the value explicitly, as default value is “Yes”, which means when the “LoginToConsole” is used as is, without enabling it and set as No, the default value will make the Robot look for an existing console session, which in this case would not be available. Our aim is to make the Robot create a non console session to run it’s UI activities.
    Should the robot appear as disconnected in Orchestrator, please ensure that this is installed as a Windows service and not in User Mode.
    Please find more information here and here .

The Problem was solved when I reinstalled UiPath in Service Mode.

1 Like

Thank you for the solution it also worked on my side. I also added Width:1920 Height:1080 Depth:32.