I’d like to get some opinions on how you would handle the following scenario in a UiPath REFramework process.
For each transaction, the workflow does the following:
Application launches successfully
Login page loads successfully
Username and password are entered
Login button is clicked
A CAPTCHA unexpectedly appears
The bot cannot proceed with the transaction
My question is: How should this situation be classified?
At first, it may seem like an Application Exception because the bot cannot continue interacting with the application. However, an Application Exception would normally cause the transaction to be retried.
In this case, if the CAPTCHA is still present, retrying the transaction may simply result in the same failure again.
At the same time, I’m not sure whether it should be considered a Business Exception, because:
The transaction data is valid
The application itself is available
There is no application crash
The issue is caused by an unexpected CAPTCHA challenge
So I’m curious how experienced UiPath developers would classify and handle this situation.
Questions:
Would you classify the CAPTCHA as a Business Exception, Application Exception, or another type of exception?
In REFramework, would you allow the transaction to be retried, or would you mark it as failed without retrying?
Would you skip the transaction, stop the entire process, or send an alert to support?
Would your approach change if the CAPTCHA appears only occasionally versus appearing consistently?
Is there a recommended UiPath pattern for handling this kind of unexpected authentication/security challenge?
I’d especially appreciate explanations based on real-world REFramework implementations and exception-handling best practices.
CAPTCHA = Application (System) Exception, not a Business Exception, because the transaction data is valid but the bot is blocked by an unexpected security challenge.
Retry? Only one retry after reinitializing the application/session. Don’t keep retrying the same transaction if the CAPTCHA is still present.
If CAPTCHA persists: Stop the process and send an alert (with logs/screenshot) to support.
Occasional vs consistent CAPTCHA:
Occasional: Reinitialize once and retry.
Consistent: Treat it as an environment/security issue and terminate the job.
Recommended UiPath pattern: Detect CAPTCHA explicitly, handle it as a System Exception, and use Action Center/Human-in-the-Loop if CAPTCHA is an expected authentication step.
@Abhinay_Reddy1 I agree with the System/Application Exception approach, but I would handle one part slightly differently.
Since the CAPTCHA appears during login, this is really an application/session-level issue rather than a problem with the transaction itself. I wouldn’t use a BusinessRuleException just to avoid retries, because the transaction data is still valid.
I would detect the CAPTCHA explicitly in the login/Init workflow. If it appears occasionally, reinitialize the application/session and allow one controlled retry. If the CAPTCHA is still present after that, capture a screenshot/log the details, notify support and stop the job.
I also wouldn’t simply skip the current transaction and continue with the next one. If authentication is blocked, the following transactions will most likely fail for the same reason.
So the flow would be: Detect CAPTCHA → one session/login retry → if still present, stop processing + alert support.
If the CAPTCHA occurs later while processing a specific transaction, then failing that transaction as an Application Exception makes sense.
Also, if CAPTCHA is an expected part of the authentication flow, I wouldn’t try to automate or bypass it. The better long-term option is to work with the application/security team on an approved bot authentication method such as a service account, API, SSO, or another supported mechanism. Human-in-the-loop could be considered only if that is approved by the application/security policy.
The main point is that exception classification and retry strategy should be kept separate. It is still an Application/System issue even when you deliberately decide not to keep retrying it.
Ideally, in REFramework, the login and CAPTCHA check should be handled in the Initialization state if the application requires login only once for the entire process.
You can check whether the CAPTCHA is present after login. If it appears, use Throw to raise a System Exception. This will move the process to the End Process state without retrieving or processing any transaction items.
If the application requires a fresh login for every transaction, then after detecting the CAPTCHA, throw an exception with a specific message.
In the Set Transaction Status workflow, check for that specific CAPTCHA message. Based on this, add a new Transition (CAPTCHA) to the End Process state, and you can add take a screenshot, add a meaningful log message in this Transition state.