2024-05-15 13:35:45 -07:00
from fastapi import status
2024-03-01 10:09:30 -08:00
class SkyvernException ( Exception ) :
def __init__ ( self , message : str | None = None ) :
self . message = message
super ( ) . __init__ ( message )
2025-03-16 15:46:34 -07:00
class SkyvernClientException ( SkyvernException ) :
def __init__ ( self , message : str | None = None , status_code : int | None = None ) :
self . status_code = status_code
super ( ) . __init__ ( message )
2024-05-15 13:35:45 -07:00
class SkyvernHTTPException ( SkyvernException ) :
def __init__ ( self , message : str | None = None , status_code : int = status . HTTP_400_BAD_REQUEST ) :
self . status_code = status_code
super ( ) . __init__ ( message )
2024-10-04 13:15:49 -07:00
class DisabledBlockExecutionError ( SkyvernHTTPException ) :
def __init__ ( self , message : str | None = None ) :
super ( ) . __init__ ( message , status_code = status . HTTP_400_BAD_REQUEST )
2025-12-18 18:16:09 -07:00
class RateLimitExceeded ( SkyvernHTTPException ) :
def __init__ ( self , organization_id : str , max_requests : int , window_seconds : int ) :
message = (
f " Rate limit exceeded for organization { organization_id } . "
f " Maximum { max_requests } requests per { window_seconds } seconds allowed. "
)
super ( ) . __init__ ( message , status_code = status . HTTP_429_TOO_MANY_REQUESTS )
2024-03-01 10:09:30 -08:00
class InvalidOpenAIResponseFormat ( SkyvernException ) :
def __init__ ( self , message : str | None = None ) :
super ( ) . __init__ ( f " Invalid response format: { message } " )
class FailedToSendWebhook ( SkyvernException ) :
2024-05-16 18:20:11 -07:00
def __init__ (
self ,
task_id : str | None = None ,
workflow_run_id : str | None = None ,
workflow_id : str | None = None ,
2025-02-23 16:03:49 -08:00
task_v2_id : str | None = None ,
2024-05-16 18:20:11 -07:00
) :
2024-03-01 10:09:30 -08:00
workflow_run_str = f " workflow_run_id= { workflow_run_id } " if workflow_run_id else " "
workflow_str = f " workflow_id= { workflow_id } " if workflow_id else " "
task_str = f " task_id= { task_id } " if task_id else " "
2025-02-23 16:03:49 -08:00
task_v2_str = f " task_v2_id= { task_v2_id } " if task_v2_id else " "
super ( ) . __init__ ( f " Failed to send webhook. { workflow_run_str } { workflow_str } { task_str } { task_v2_str } " )
2024-03-01 10:09:30 -08:00
class ProxyLocationNotSupportedError ( SkyvernException ) :
def __init__ ( self , proxy_location : str | None = None ) :
super ( ) . __init__ ( f " Unknown proxy location: { proxy_location } " )
2025-10-22 14:26:14 -07:00
class WebhookReplayError ( SkyvernHTTPException ) :
def __init__ (
self ,
message : str | None = None ,
* ,
status_code : int = status . HTTP_400_BAD_REQUEST ,
) :
super ( ) . __init__ ( message = message or " Webhook replay failed. " , status_code = status_code )
class MissingWebhookTarget ( WebhookReplayError ) :
def __init__ ( self , message : str | None = None ) :
super ( ) . __init__ ( message or " No webhook URL configured for the run. " )
class MissingApiKey ( WebhookReplayError ) :
def __init__ ( self , message : str | None = None ) :
super ( ) . __init__ ( message or " Organization does not have a valid API key configured. " )
2024-05-15 13:35:45 -07:00
class TaskNotFound ( SkyvernHTTPException ) :
2024-03-01 10:09:30 -08:00
def __init__ ( self , task_id : str | None = None ) :
2024-05-15 13:35:45 -07:00
super ( ) . __init__ ( f " Task { task_id } not found " , status_code = status . HTTP_404_NOT_FOUND )
2024-03-01 10:09:30 -08:00
class MissingElement ( SkyvernException ) :
2024-07-04 10:45:47 +08:00
def __init__ ( self , selector : str | None = None , element_id : str | None = None ) :
2024-03-01 10:09:30 -08:00
super ( ) . __init__ (
f " Found no elements. Might be due to previous actions which removed this element. "
2024-07-04 10:45:47 +08:00
f " selector= { selector } element_id= { element_id } " ,
2024-03-01 10:09:30 -08:00
)
2025-11-13 17:18:32 -08:00
class MissingExtractActionsResponse ( SkyvernException ) :
def __init__ ( self ) - > None :
super ( ) . __init__ ( " extract-actions response missing " )
2024-03-01 10:09:30 -08:00
class MultipleElementsFound ( SkyvernException ) :
2024-07-04 10:45:47 +08:00
def __init__ ( self , num : int , selector : str | None = None , element_id : str | None = None ) :
2024-03-01 10:09:30 -08:00
super ( ) . __init__ (
2024-07-04 10:45:47 +08:00
f " Found { num } elements. Expected 1. num_elements= { num } selector= { selector } element_id= { element_id } " ,
2024-03-01 10:09:30 -08:00
)
class MissingFileUrl ( SkyvernException ) :
def __init__ ( self ) - > None :
super ( ) . __init__ ( " File url is missing. " )
class ImaginaryFileUrl ( SkyvernException ) :
def __init__ ( self , file_url : str ) - > None :
super ( ) . __init__ ( f " File url { file_url } is imaginary. " )
2025-12-15 14:30:32 +08:00
class DownloadedFileNotFound ( SkyvernException ) :
def __init__ ( self , downloaded_path : str , download_url : str | None = None ) - > None :
message = f " Downloaded file does not exist at path: { downloaded_path } . This may indicate the download failed silently or the file was removed. "
if download_url :
message + = f " Download URL: { download_url } "
super ( ) . __init__ ( message )
2024-03-01 10:09:30 -08:00
class MissingBrowserState ( SkyvernException ) :
2024-11-01 15:13:41 -07:00
def __init__ ( self , task_id : str | None = None , workflow_run_id : str | None = None ) - > None :
task_str = f " task_id= { task_id } " if task_id else " "
workflow_run_str = f " workflow_run_id= { workflow_run_id } " if workflow_run_id else " "
super ( ) . __init__ ( f " Browser state for { task_str } { workflow_run_str } is missing. " )
2024-03-01 10:09:30 -08:00
class MissingBrowserStatePage ( SkyvernException ) :
def __init__ ( self , task_id : str | None = None , workflow_run_id : str | None = None ) :
task_str = f " task_id= { task_id } " if task_id else " "
workflow_run_str = f " workflow_run_id= { workflow_run_id } " if workflow_run_id else " "
super ( ) . __init__ ( f " Browser state page is missing. { task_str } { workflow_run_str } " )
class MissingWorkflowRunBrowserState ( SkyvernException ) :
def __init__ ( self , workflow_run_id : str , task_id : str ) - > None :
super ( ) . __init__ ( f " Browser state for workflow run { workflow_run_id } and task { task_id } is missing. " )
class CaptchaNotSolvedInTime ( SkyvernException ) :
def __init__ ( self , task_id : str , final_state : str ) - > None :
super ( ) . __init__ ( f " Captcha not solved in time for task { task_id } . Final state: { final_state } " )
class EnablingCaptchaSolver ( SkyvernException ) :
def __init__ ( self ) - > None :
super ( ) . __init__ ( " Enabling captcha solver. Reload the page and try again. " )
class ContextParameterValueNotFound ( SkyvernException ) :
def __init__ ( self , parameter_key : str , existing_keys : list [ str ] , workflow_run_id : str ) - > None :
super ( ) . __init__ (
f " Context parameter value not found during workflow run { workflow_run_id } . "
f " Parameter key: { parameter_key } . Existing keys: { existing_keys } "
)
class UnknownBlockType ( SkyvernException ) :
def __init__ ( self , block_type : str ) - > None :
super ( ) . __init__ ( f " Unknown block type { block_type } " )
2025-07-04 15:34:15 -04:00
class BlockNotFound ( SkyvernException ) :
def __init__ ( self , block_label : str ) - > None :
super ( ) . __init__ ( f " Block { block_label } not found " )
2024-05-15 13:35:45 -07:00
class WorkflowNotFound ( SkyvernHTTPException ) :
2024-05-16 10:51:22 -07:00
def __init__ (
self ,
workflow_id : str | None = None ,
workflow_permanent_id : str | None = None ,
version : int | None = None ,
) - > None :
workflow_repr = " "
if workflow_id :
workflow_repr = f " workflow_id= { workflow_id } "
if workflow_permanent_id :
if version :
workflow_repr = f " workflow_permanent_id= { workflow_permanent_id } , version= { version } "
else :
workflow_repr = f " workflow_permanent_id= { workflow_permanent_id } "
2024-05-16 18:20:11 -07:00
super ( ) . __init__ (
f " Workflow not found. { workflow_repr } " ,
status_code = status . HTTP_404_NOT_FOUND ,
)
2024-03-01 10:09:30 -08:00
2025-11-04 18:30:17 -05:00
class WorkflowNotFoundForWorkflowRun ( SkyvernHTTPException ) :
def __init__ (
self ,
workflow_run_id : str | None = None ,
) - > None :
super ( ) . __init__ (
f " Workflow not found for workflow run { workflow_run_id } " ,
status_code = status . HTTP_404_NOT_FOUND ,
)
2025-01-09 11:26:30 -08:00
class WorkflowRunNotFound ( SkyvernHTTPException ) :
2024-03-01 10:09:30 -08:00
def __init__ ( self , workflow_run_id : str ) - > None :
2025-01-09 11:26:30 -08:00
super ( ) . __init__ ( f " WorkflowRun { workflow_run_id } not found " , status_code = status . HTTP_404_NOT_FOUND )
2024-03-01 10:09:30 -08:00
2024-08-07 17:40:16 -07:00
class MissingValueForParameter ( SkyvernHTTPException ) :
2024-03-01 10:09:30 -08:00
def __init__ ( self , parameter_key : str , workflow_id : str , workflow_run_id : str ) - > None :
super ( ) . __init__ (
2025-02-17 17:11:19 +08:00
f " Missing value for parameter { parameter_key } in workflow run { workflow_run_id } of workflow { workflow_id } " ,
status_code = status . HTTP_400_BAD_REQUEST ,
2024-03-01 10:09:30 -08:00
)
2025-11-29 02:57:20 +03:00
class WorkflowRunParameterPersistenceError ( SkyvernException ) :
def __init__ ( self , parameter_key : str , workflow_id : str , workflow_run_id : str , reason : str ) - > None :
super ( ) . __init__ (
f " Failed to persist workflow parameter ' { parameter_key } ' for workflow run { workflow_run_id } "
f " of workflow { workflow_id } . Reason: { reason } "
)
2025-06-18 00:33:16 -04:00
class InvalidCredentialId ( SkyvernHTTPException ) :
def __init__ ( self , credential_id : str ) - > None :
super ( ) . __init__ (
f " Invalid credential ID: { credential_id } . Failed to resolve to a valid credential. " ,
status_code = status . HTTP_400_BAD_REQUEST ,
)
2024-05-15 13:35:45 -07:00
class WorkflowParameterNotFound ( SkyvernHTTPException ) :
2024-03-01 10:09:30 -08:00
def __init__ ( self , workflow_parameter_id : str ) - > None :
2024-05-16 18:20:11 -07:00
super ( ) . __init__ (
f " Workflow parameter { workflow_parameter_id } not found " ,
status_code = status . HTTP_404_NOT_FOUND ,
)
2024-03-01 10:09:30 -08:00
class FailedToNavigateToUrl ( SkyvernException ) :
def __init__ ( self , url : str , error_message : str ) - > None :
2024-04-19 00:12:02 -07:00
self . url = url
self . error_message = error_message
2024-03-01 10:09:30 -08:00
super ( ) . __init__ ( f " Failed to navigate to url { url } . Error message: { error_message } " )
2024-06-24 23:14:45 +08:00
class FailedToReloadPage ( SkyvernException ) :
def __init__ ( self , url : str , error_message : str ) - > None :
self . url = url
self . error_message = error_message
super ( ) . __init__ ( f " Failed to reload page url { url } . Error message: { error_message } " )
class FailedToStopLoadingPage ( SkyvernException ) :
def __init__ ( self , url : str , error_message : str ) - > None :
self . url = url
self . error_message = error_message
super ( ) . __init__ ( f " Failed to stop loading page url { url } . Error message: { error_message } " )
2025-10-23 14:38:03 +08:00
class EmptyBrowserContext ( SkyvernException ) :
def __init__ ( self ) - > None :
super ( ) . __init__ ( " Browser context is empty " )
2024-03-01 10:09:30 -08:00
class UnexpectedTaskStatus ( SkyvernException ) :
def __init__ ( self , task_id : str , status : str ) - > None :
super ( ) . __init__ ( f " Unexpected task status { status } for task { task_id } " )
class InvalidWorkflowTaskURLState ( SkyvernException ) :
def __init__ ( self , workflow_run_id : str ) - > None :
2024-03-14 00:00:49 -07:00
super ( ) . __init__ ( f " No Valid URL found in the first task of workflow run { workflow_run_id } " )
2024-03-01 10:09:30 -08:00
class DisabledFeature ( SkyvernException ) :
def __init__ ( self , feature : str ) - > None :
super ( ) . __init__ ( f " Feature { feature } is disabled " )
class UnknownBrowserType ( SkyvernException ) :
def __init__ ( self , browser_type : str ) - > None :
super ( ) . __init__ ( f " Unknown browser type { browser_type } " )
class UnknownErrorWhileCreatingBrowserContext ( SkyvernException ) :
def __init__ ( self , browser_type : str , exception : Exception ) - > None :
super ( ) . __init__ (
f " Unknown error while creating browser context for { browser_type } . Exception type: { type ( exception ) } Exception message: { str ( exception ) } "
)
2024-05-15 13:35:45 -07:00
class OrganizationNotFound ( SkyvernHTTPException ) :
2024-03-01 10:09:30 -08:00
def __init__ ( self , organization_id : str ) - > None :
2024-05-16 18:20:11 -07:00
super ( ) . __init__ (
f " Organization { organization_id } not found " ,
status_code = status . HTTP_404_NOT_FOUND ,
)
2024-03-01 10:09:30 -08:00
2024-05-15 13:35:45 -07:00
class StepNotFound ( SkyvernHTTPException ) :
2024-03-01 10:09:30 -08:00
def __init__ ( self , organization_id : str , task_id : str , step_id : str | None = None ) - > None :
2024-05-15 13:35:45 -07:00
super ( ) . __init__ (
f " Step { step_id or ' latest ' } not found. organization_id= { organization_id } task_id= { task_id } " ,
status_code = status . HTTP_404_NOT_FOUND ,
)
2024-03-12 22:28:16 -07:00
class FailedToTakeScreenshot ( SkyvernException ) :
def __init__ ( self , error_message : str ) - > None :
super ( ) . __init__ ( f " Failed to take screenshot. Error message: { error_message } " )
2024-06-24 23:14:45 +08:00
class EmptyScrapePage ( SkyvernException ) :
def __init__ ( self ) - > None :
super ( ) . __init__ ( " Failed to scrape the page, returned an NONE result " )
2025-03-21 15:47:36 -07:00
class ScrapingFailed ( SkyvernException ) :
2025-07-17 16:19:16 -04:00
def __init__ ( self , * , reason : str | None = None ) - > None :
self . reason = reason
2025-03-21 15:47:36 -07:00
super ( ) . __init__ ( " Scraping failed. " )
2025-07-29 14:40:54 +08:00
class ScrapingFailedBlankPage ( ScrapingFailed ) :
2025-07-17 16:19:16 -04:00
def __init__ ( self ) - > None :
2025-07-29 14:40:54 +08:00
super ( ) . __init__ ( reason = " It ' s a blank page. Please ensure there is a non-blank page for Skyvern to work with. " )
2025-07-17 16:19:16 -04:00
2024-03-12 22:28:16 -07:00
class WorkflowRunContextNotInitialized ( SkyvernException ) :
def __init__ ( self , workflow_run_id : str ) - > None :
2024-03-13 22:00:26 -07:00
super ( ) . __init__ ( f " WorkflowRunContext not initialized for workflow run { workflow_run_id } " )
2024-03-31 01:58:11 -07:00
class DownloadFileMaxSizeExceeded ( SkyvernException ) :
def __init__ ( self , max_size : int ) - > None :
self . max_size = max_size
super ( ) . __init__ ( f " Download file size exceeded the maximum allowed size of { max_size } MB. " )
2024-04-03 16:01:03 -07:00
2025-02-03 23:49:46 +08:00
class DownloadFileMaxWaitingTime ( SkyvernException ) :
2025-09-02 15:43:07 +08:00
def __init__ ( self , downloading_files : list [ str ] ) - > None :
2025-02-03 23:49:46 +08:00
self . downloading_files = downloading_files
super ( ) . __init__ ( f " Long-time downloading files [ { downloading_files } ]. " )
2024-12-06 02:25:13 +08:00
class NoFileDownloadTriggered ( SkyvernException ) :
def __init__ ( self , element_id : str ) - > None :
super ( ) . __init__ ( f " Clicking on element doesn ' t trigger the file download. element_id= { element_id } " )
2025-02-20 13:50:41 -08:00
class BitwardenSecretError ( SkyvernException ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Bitwarden secret error: { message } " )
2024-04-03 16:01:03 -07:00
class BitwardenBaseError ( SkyvernException ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Bitwarden error: { message } " )
class BitwardenLoginError ( BitwardenBaseError ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error logging in to Bitwarden: { message } " )
class BitwardenUnlockError ( BitwardenBaseError ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error unlocking Bitwarden: { message } " )
2025-02-20 13:50:41 -08:00
class BitwardenCreateCollectionError ( BitwardenBaseError ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error creating collection in Bitwarden: { message } " )
class BitwardenCreateLoginItemError ( BitwardenBaseError ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error creating login item in Bitwarden: { message } " )
class BitwardenCreateCreditCardItemError ( BitwardenBaseError ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error creating credit card item in Bitwarden: { message } " )
class BitwardenCreateFolderError ( BitwardenBaseError ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error creating folder in Bitwarden: { message } " )
class BitwardenGetItemError ( BitwardenBaseError ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error getting item in Bitwarden: { message } " )
2024-04-03 16:01:03 -07:00
class BitwardenListItemsError ( BitwardenBaseError ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error listing items in Bitwarden: { message } " )
2024-04-10 23:31:17 -07:00
class BitwardenTOTPError ( BitwardenBaseError ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error generating TOTP in Bitwarden: { message } " )
2024-04-03 16:01:03 -07:00
class BitwardenLogoutError ( BitwardenBaseError ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error logging out of Bitwarden: { message } " )
2024-05-13 09:37:17 +08:00
2024-08-02 12:53:05 -07:00
class BitwardenSyncError ( BitwardenBaseError ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error syncing Bitwarden: { message } " )
2024-10-02 15:16:08 -07:00
class BitwardenAccessDeniedError ( BitwardenBaseError ) :
def __init__ ( self ) - > None :
super ( ) . __init__ (
2024-10-03 16:18:21 -07:00
" Current organization does not have access to the specified Bitwarden collection. "
" Contact Skyvern support to enable access. This is a security layer on top of Bitwarden, "
" Skyvern team needs to let your Skyvern account access the Bitwarden collection. "
2024-10-02 15:16:08 -07:00
)
2025-02-14 00:00:19 +08:00
class CredentialParameterParsingError ( SkyvernException ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error parsing credential parameter: { message } " )
class CredentialParameterNotFoundError ( SkyvernException ) :
def __init__ ( self , credential_parameter_id : str ) - > None :
super ( ) . __init__ ( f " Could not find credential parameter: { credential_parameter_id } " )
2024-05-13 09:37:17 +08:00
class UnknownElementTreeFormat ( SkyvernException ) :
def __init__ ( self , fmt : str ) - > None :
super ( ) . __init__ ( f " Unknown element tree format { fmt } " )
2024-05-25 18:24:35 -07:00
2025-02-22 00:44:12 -08:00
class TerminationError ( SkyvernException ) :
def __init__ ( self , reason : str , step_id : str | None = None , task_id : str | None = None ) - > None :
super ( ) . __init__ ( f " Termination error. Reason: { reason } " )
class StepTerminationError ( TerminationError ) :
def __init__ ( self , reason : str , step_id : str | None = None , task_id : str | None = None ) - > None :
2024-06-05 13:30:09 -07:00
super ( ) . __init__ ( f " Step { step_id } cannot be executed and task is failed. Reason: { reason } " )
2025-02-22 00:44:12 -08:00
class TaskTerminationError ( TerminationError ) :
def __init__ ( self , reason : str , step_id : str | None = None , task_id : str | None = None ) - > None :
super ( ) . __init__ ( f " Task { task_id } failed. Reason: { reason } " )
2025-01-17 09:17:31 -08:00
class BlockTerminationError ( SkyvernException ) :
def __init__ ( self , workflow_run_block_id : str , workflow_run_id : str , reason : str ) - > None :
super ( ) . __init__ (
f " Block { workflow_run_block_id } cannot be executed and workflow run { workflow_run_id } is failed. Reason: { reason } "
)
2024-06-05 13:30:09 -07:00
class StepUnableToExecuteError ( SkyvernException ) :
def __init__ ( self , step_id : str , reason : str ) - > None :
super ( ) . __init__ ( f " Step { step_id } cannot be executed and task execution is stopped. Reason: { reason } " )
2024-05-30 09:23:58 +08:00
2024-08-29 11:11:32 +08:00
class SVGConversionFailed ( SkyvernException ) :
def __init__ ( self , svg_html : str ) - > None :
super ( ) . __init__ ( f " Failed to convert SVG after max retries. svg_html= { svg_html } " )
2024-05-30 09:23:58 +08:00
class UnsupportedActionType ( SkyvernException ) :
def __init__ ( self , action_type : str ) :
super ( ) . __init__ ( f " Unsupport action type: { action_type } " )
2024-06-07 11:28:19 -07:00
class InvalidElementForTextInput ( SkyvernException ) :
def __init__ ( self , element_id : str , tag_name : str ) :
super ( ) . __init__ ( f " The { tag_name } element with id= { element_id } doesn ' t support text input. " )
2024-06-13 15:34:21 +08:00
class ElementIsNotLabel ( SkyvernException ) :
def __init__ ( self , tag_name : str ) :
super ( ) . __init__ ( f " < { tag_name } > element is not <label> " )
2024-07-06 13:32:55 +08:00
class NoneFrameError ( SkyvernException ) :
def __init__ ( self , frame_id : str ) :
super ( ) . __init__ ( f " frame content is none. frame_id= { frame_id } " )
2024-06-13 15:34:21 +08:00
class MissingElementDict ( SkyvernException ) :
def __init__ ( self , element_id : str ) - > None :
2024-07-01 21:24:52 -07:00
super ( ) . __init__ ( f " Invalid element id. element_id= { element_id } " )
2024-06-13 15:34:21 +08:00
class MissingElementInIframe ( SkyvernException ) :
def __init__ ( self , element_id : str ) - > None :
super ( ) . __init__ ( f " Found no iframe includes the element. element_id= { element_id } " )
2024-06-18 11:34:52 +08:00
2024-07-04 10:45:47 +08:00
class MissingElementInCSSMap ( SkyvernException ) :
def __init__ ( self , element_id : str ) - > None :
super ( ) . __init__ ( f " Found no css selector in the CSS map for the element. element_id= { element_id } " )
2024-06-18 11:34:52 +08:00
class InputActionOnSelect2Dropdown ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ (
f " Input action on a select element, please try to use select action on this element. element_id= { element_id } "
)
2024-06-25 01:46:54 +08:00
2024-07-01 21:24:52 -07:00
class FailToClick ( SkyvernException ) :
2024-11-14 02:33:44 +08:00
def __init__ ( self , element_id : str , msg : str , anchor : str = " self " ) :
super ( ) . __init__ ( f " Failed to click( { anchor } ). element_id= { element_id } , error_msg= { msg } " )
2024-07-01 21:24:52 -07:00
2025-12-09 17:27:26 +02:00
class FailToHover ( SkyvernException ) :
def __init__ ( self , element_id : str , msg : str ) :
super ( ) . __init__ ( f " Failed to hover. element_id= { element_id } , error_msg= { msg } " )
2024-06-25 01:46:54 +08:00
class FailToSelectByLabel ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ ( f " Failed to select by label. element_id= { element_id } " )
class FailToSelectByIndex ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ ( f " Failed to select by index. element_id= { element_id } " )
2025-07-01 14:12:39 +09:00
class EmptyDomOrHtmlTree ( SkyvernException ) :
def __init__ ( self ) - > None :
super ( ) . __init__ ( " Empty dom or html tree " )
2024-06-25 01:46:54 +08:00
class OptionIndexOutOfBound ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ ( f " Option index is out of bound. element_id= { element_id } " )
class FailToSelectByValue ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ ( f " Failed to select by value. element_id= { element_id } " )
class EmptySelect ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ (
f " nothing is selected, try to select again. element_id= { element_id } " ,
)
2024-06-26 15:25:15 -07:00
class TaskAlreadyCanceled ( SkyvernHTTPException ) :
def __init__ ( self , new_status : str , task_id : str ) :
super ( ) . __init__ (
f " Invalid task status transition to { new_status } for { task_id } because task is already canceled "
)
2025-01-22 13:23:10 +08:00
class TaskAlreadyTimeout ( SkyvernException ) :
def __init__ ( self , task_id : str ) :
super ( ) . __init__ ( f " Task { task_id } is timed out " )
2024-06-26 15:25:15 -07:00
class InvalidTaskStatusTransition ( SkyvernHTTPException ) :
def __init__ ( self , old_status : str , new_status : str , task_id : str ) :
super ( ) . __init__ ( f " Invalid task status transition from { old_status } to { new_status } for { task_id } " )
2024-07-09 02:22:16 +08:00
class ErrFoundSelectableElement ( SkyvernException ) :
def __init__ ( self , element_id : str , err : Exception ) :
super ( ) . __init__ (
f " error when selecting elements in the children list. element_id= { element_id } , error= { repr ( err ) } "
)
class NoSelectableElementFound ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ ( f " No selectable elements found in the children list. element_id= { element_id } " )
2024-07-09 17:45:51 -07:00
class HttpException ( SkyvernException ) :
def __init__ ( self , status_code : int , url : str , msg : str | None = None ) - > None :
super ( ) . __init__ ( f " HTTP Exception, status_code= { status_code } , url= { url } " + ( f " , msg= { msg } " if msg else " " ) )
2024-07-11 02:45:13 +08:00
class WrongElementToUploadFile ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ (
f " No file chooser dialog opens, so file can ' t be uploaded through element { element_id } . Please try to upload again with another element. "
)
2024-07-11 21:34:00 -07:00
class FailedToFetchSecret ( SkyvernException ) :
def __init__ ( self ) - > None :
super ( ) . __init__ ( " Failed to get the actual value of the secret parameter " )
2024-08-06 13:30:52 +08:00
class NoIncrementalElementFoundForCustomSelection ( SkyvernException ) :
def __init__ ( self , element_id : str ) - > None :
super ( ) . __init__ (
2025-02-03 19:19:39 +08:00
f " No incremental element found, try it again later or try another element. element_id= { element_id } "
2024-08-06 13:30:52 +08:00
)
2024-09-14 17:28:08 +08:00
class NoAvailableOptionFoundForCustomSelection ( SkyvernException ) :
def __init__ ( self , reason : str | None ) - > None :
super ( ) . __init__ ( f " No available option to select. reason: { reason } . " )
2024-08-06 13:30:52 +08:00
class NoElementMatchedForTargetOption ( SkyvernException ) :
def __init__ ( self , target : str , reason : str | None ) - > None :
super ( ) . __init__ (
f " No element matches for the target value, try another value. reason: { reason } . target_value= ' { target } ' . "
)
class NoElementBoudingBox ( SkyvernException ) :
def __init__ ( self , element_id : str ) - > None :
super ( ) . __init__ ( f " Element does not have a bounding box. element_id= { element_id } " )
2024-08-21 10:54:32 +08:00
class NoIncrementalElementFoundForAutoCompletion ( SkyvernException ) :
def __init__ ( self , element_id : str , text : str ) - > None :
super ( ) . __init__ ( f " No auto completion shown up after fill in [ { text } ]. element_id= { element_id } " )
class NoSuitableAutoCompleteOption ( SkyvernException ) :
def __init__ ( self , reasoning : str | None , target_value : str ) - > None :
super ( ) . __init__ (
f " No suitable auto complete option to choose. target_value= { target_value } , reasoning= { reasoning } "
)
class NoAutoCompleteOptionMeetCondition ( SkyvernException ) :
def __init__ (
self , reasoning : str | None , required_relevance : float , target_value : str , closest_relevance : float
) - > None :
super ( ) . __init__ (
f " No auto complete option meet the condition(relevance_float> { required_relevance } ). reasoning= { reasoning } , target_value= { target_value } , closest_relevance= { closest_relevance } "
)
class ErrEmptyTweakValue ( SkyvernException ) :
def __init__ ( self , reasoning : str | None , current_value : str ) - > None :
super ( ) . __init__ (
f " Empty tweaked value for the current value. reasoning= { reasoning } , current_value= { current_value } "
)
class FailToFindAutocompleteOption ( SkyvernException ) :
def __init__ ( self , current_value : str ) - > None :
super ( ) . __init__ (
f " Can ' t find a suitable auto completion for the current value, maybe retry with another reasonable value. current_value= { current_value } "
)
2024-09-17 18:59:40 -07:00
class IllegitComplete ( SkyvernException ) :
def __init__ ( self , data : dict | None = None ) - > None :
data_str = f " , data= { data } " if data else " "
super ( ) . __init__ ( f " Illegit complete { data_str } " )
2024-10-15 12:06:50 -07:00
class CachedActionPlanError ( SkyvernException ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( message )
2024-10-17 23:47:59 -07:00
2024-12-08 12:43:59 -08:00
class InvalidUrl ( SkyvernHTTPException ) :
2024-10-17 23:47:59 -07:00
def __init__ ( self , url : str ) - > None :
2024-12-06 11:56:12 +08:00
super ( ) . __init__ ( f " Invalid URL: { url } . Skyvern supports HTTP and HTTPS urls with max 2083 character length. " )
2024-10-20 18:33:05 -07:00
class BlockedHost ( SkyvernHTTPException ) :
def __init__ ( self , host : str ) - > None :
super ( ) . __init__ (
f " The host in your url is blocked: { host } " ,
status_code = status . HTTP_400_BAD_REQUEST ,
)
2024-10-22 17:36:25 -07:00
class InvalidWorkflowParameter ( SkyvernHTTPException ) :
def __init__ ( self , expected_parameter_type : str , value : str , workflow_permanent_id : str | None = None ) - > None :
2024-10-22 18:02:29 -07:00
message = f " Invalid workflow parameter. Expected parameter type: { expected_parameter_type } . Value: { value } . "
2024-10-22 17:36:25 -07:00
if workflow_permanent_id :
message + = f " Workflow permanent id: { workflow_permanent_id } "
super ( ) . __init__ (
message ,
status_code = status . HTTP_400_BAD_REQUEST ,
)
2024-10-25 14:52:02 +08:00
class InteractWithDisabledElement ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ (
f " The element(id= { element_id } ) now is disabled, try to interact with it later when it ' s enabled. "
)
2024-11-26 11:29:33 +08:00
2025-05-08 22:52:12 -07:00
class InputToInvisibleElement ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ (
f " The element(id= { element_id } ) now is not visible. Try to interact with other elements, or try to interact with it later when it ' s visible. "
)
2025-10-29 13:10:21 +08:00
class InputToReadonlyElement ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ (
f " The element(id= { element_id } ) now is readonly. Try to interact with other elements, or try to interact with it later when it ' s not readonly. "
)
2024-11-26 11:29:33 +08:00
class FailedToParseActionInstruction ( SkyvernException ) :
def __init__ ( self , reason : str | None , error_type : str | None ) :
super ( ) . __init__ (
f " Failed to parse the action instruction as ' { reason } ( { error_type } ) ' " ,
)
class UnsupportedTaskType ( SkyvernException ) :
def __init__ ( self , task_type : str ) :
super ( ) . __init__ ( f " Not supported task type [ { task_type } ] " )
2024-12-16 23:34:21 +08:00
class InteractWithDropdownContainer ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ (
f " Select on the dropdown container instead of the option, try again with another element. element_id= { element_id } "
)
2024-12-19 17:26:08 -08:00
class UrlGenerationFailure ( SkyvernHTTPException ) :
def __init__ ( self ) - > None :
super ( ) . __init__ ( " Failed to generate the url for the prompt " )
2025-01-27 12:53:23 +08:00
2025-02-23 16:03:49 -08:00
class TaskV2NotFound ( SkyvernHTTPException ) :
def __init__ ( self , task_v2_id : str ) - > None :
super ( ) . __init__ ( f " Task v2 { task_v2_id } not found " )
2025-02-14 01:50:38 +08:00
class NoTOTPVerificationCodeFound ( SkyvernHTTPException ) :
def __init__ (
self ,
task_id : str | None = None ,
workflow_run_id : str | None = None ,
2025-05-15 19:49:42 -07:00
workflow_id : str | None = None ,
2025-02-14 01:50:38 +08:00
totp_verification_url : str | None = None ,
totp_identifier : str | None = None ,
) - > None :
msg = " No TOTP verification code found. "
if task_id :
msg + = f " task_id= { task_id } "
if workflow_run_id :
msg + = f " workflow_run_id= { workflow_run_id } "
2025-05-15 19:49:42 -07:00
if workflow_id :
msg + = f " workflow_id= { workflow_id } "
2025-02-14 01:50:38 +08:00
if totp_verification_url :
msg + = f " totp_verification_url= { totp_verification_url } "
if totp_identifier :
msg + = f " totp_identifier= { totp_identifier } "
super ( ) . __init__ ( msg )
2025-03-02 23:27:20 -05:00
2025-09-19 10:08:25 +08:00
class FailedToGetTOTPVerificationCode ( SkyvernException ) :
reason : str | None = None
def __init__ (
self ,
task_id : str | None = None ,
workflow_run_id : str | None = None ,
workflow_id : str | None = None ,
totp_verification_url : str | None = None ,
totp_identifier : str | None = None ,
reason : str | None = None ,
) - > None :
self . reason = reason
msg = " Failed to get TOTP verification code. "
if task_id :
msg + = f " task_id= { task_id } "
if workflow_run_id :
msg + = f " workflow_run_id= { workflow_run_id } "
if workflow_id :
msg + = f " workflow_id= { workflow_id } "
if totp_verification_url :
msg + = f " totp_verification_url= { totp_verification_url } "
if totp_identifier :
msg + = f " totp_identifier= { totp_identifier } "
super ( ) . __init__ ( f " Failed to get TOTP verification code. reason: { reason } " )
2025-03-02 23:27:20 -05:00
class SkyvernContextWindowExceededError ( SkyvernException ) :
def __init__ ( self ) - > None :
message = " Context window exceeded. Please contact support@skyvern.com for help. "
super ( ) . __init__ ( message )
2025-04-28 09:49:44 +08:00
class LLMCallerNotFoundError ( SkyvernException ) :
def __init__ ( self , uid : str ) - > None :
super ( ) . __init__ ( f " LLM caller for { uid } is not found " )
2025-06-13 05:55:41 -07:00
class BrowserSessionAlreadyOccupiedError ( SkyvernHTTPException ) :
2025-11-28 13:14:04 +08:00
def __init__ ( self , browser_session_id : str , runnable_id : str ) - > None :
super ( ) . __init__ ( f " Browser session { browser_session_id } is already occupied by { runnable_id } " )
2025-06-13 05:55:41 -07:00
2025-07-31 15:56:38 -04:00
class BrowserSessionNotRenewable ( SkyvernException ) :
def __init__ ( self , reason : str , browser_session_id : str ) - > None :
super ( ) . __init__ ( f " Browser session { browser_session_id } is not renewable: { reason } " )
2025-06-13 05:55:41 -07:00
class MissingBrowserAddressError ( SkyvernException ) :
def __init__ ( self , browser_session_id : str ) - > None :
super ( ) . __init__ ( f " Browser session { browser_session_id } does not have an address. " )
2025-07-04 01:49:51 -07:00
class BrowserSessionNotFound ( SkyvernHTTPException ) :
def __init__ ( self , browser_session_id : str ) - > None :
super ( ) . __init__ (
f " Browser session { browser_session_id } does not exist or is not live. " ,
status_code = status . HTTP_404_NOT_FOUND ,
)
2025-07-08 08:10:44 -07:00
2025-11-04 17:36:41 -08:00
class BrowserProfileNotFound ( SkyvernHTTPException ) :
def __init__ ( self , profile_id : str , organization_id : str | None = None ) - > None :
message = f " Browser profile { profile_id } not found "
if organization_id :
message + = f " for organization { organization_id } "
super ( ) . __init__ ( message , status_code = status . HTTP_404_NOT_FOUND )
2025-10-07 16:56:53 -07:00
class CannotUpdateWorkflowDueToCodeCache ( SkyvernException ) :
def __init__ ( self , workflow_permanent_id : str ) - > None :
super ( ) . __init__ ( f " No confirmation for code cache deletion on { workflow_permanent_id } . " )
2025-07-08 08:10:44 -07:00
class APIKeyNotFound ( SkyvernHTTPException ) :
def __init__ ( self , organization_id : str ) - > None :
super ( ) . __init__ ( f " No valid API key token found for organization { organization_id } " )
2025-07-21 17:31:54 +08:00
class ElementOutOfCurrentViewport ( SkyvernException ) :
def __init__ ( self , element_id : str ) :
super ( ) . __init__ ( f " Element { element_id } is out of current viewport " )
2025-08-04 00:33:34 -07:00
2025-08-06 22:23:38 -07:00
class ScriptNotFound ( SkyvernHTTPException ) :
def __init__ ( self , script_id : str ) - > None :
super ( ) . __init__ ( f " Script { script_id } not found " )
2025-08-07 14:59:29 +08:00
class NoTOTPSecretFound ( SkyvernException ) :
def __init__ ( self ) - > None :
super ( ) . __init__ ( " No TOTP secret found " )
2025-08-15 02:24:59 +08:00
class NoElementFound ( SkyvernException ) :
def __init__ ( self ) - > None :
super ( ) . __init__ ( " No element found. " )
2025-08-28 20:05:24 -04:00
class OutputParameterNotFound ( SkyvernException ) :
def __init__ ( self , block_label : str , workflow_permanent_id : str ) - > None :
super ( ) . __init__ ( f " Output parameter for { block_label } not found in workflow { workflow_permanent_id } " )
2025-09-12 11:01:57 -06:00
class AzureBaseError ( SkyvernException ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Azure error: { message } " )
class AzureConfigurationError ( AzureBaseError ) :
def __init__ ( self , message : str ) - > None :
super ( ) . __init__ ( f " Error in Azure configuration: { message } " )
2025-10-01 08:34:29 -07:00
###### Script Exceptions ######
class ScriptTerminationException ( SkyvernException ) :
def __init__ ( self , reason : str | None = None ) - > None :
super ( ) . __init__ ( reason )
2025-11-28 09:10:41 +02:00
class InvalidSchemaError ( SkyvernException ) :
def __init__ ( self , message : str , validation_errors : list [ str ] | None = None ) :
self . message = message
self . validation_errors = validation_errors or [ ]
super ( ) . __init__ ( self . message )
2025-12-15 14:30:32 +08:00
class PDFEmbedBase64DecodeError ( SkyvernException ) :
""" Raised when failed to extract or decode base64 data from PDF embed src attribute. """
def __init__ ( self , pdf_embed_src : str | None = None , reason : str | None = None ) :
self . pdf_embed_src = pdf_embed_src
self . reason = reason
message = " Failed to extract or decode base64 data from PDF embed src "
if reason :
message + = f " . Reason: { reason } "
if pdf_embed_src :
# Truncate long base64 strings for logging
src_preview = pdf_embed_src [ : 100 ] + " ... " if len ( pdf_embed_src ) > 100 else pdf_embed_src
message + = f " . PDF embed src: { src_preview } "
super ( ) . __init__ ( message )
2025-12-17 00:59:14 +08:00
class PDFParsingError ( SkyvernException ) :
""" Raised when PDF parsing fails with all available parsers. """
def __init__ ( self , file_identifier : str , pypdf_error : str , pdfplumber_error : str ) :
self . file_identifier = file_identifier
self . pypdf_error = pypdf_error
self . pdfplumber_error = pdfplumber_error
super ( ) . __init__ (
f " Failed to parse PDF ' { file_identifier } ' . pypdf error: { pypdf_error } ; pdfplumber error: { pdfplumber_error } "
)
2026-01-15 15:58:07 +08:00
class ImaginarySecretValue ( SkyvernException ) :
def __init__ ( self , value : str ) - > None :
super ( ) . __init__ (
f " The value { value } is imaginary. Try to double-check to see if this value is included in the provided information "
)