Skip to content

Errors

Every exception the client raises, and the codes and reasons they carry. Guide: Errors.

errors

Exception hierarchy. Driver failures arrive as data (CommandResult.error) and become CommandError; server-level failures arrive as gRPC status codes and are mapped in client.py.

TapError

Bases: Exception

Base class for everything this package raises deliberately.

ServerError

Bases: TapError

The host server rejected or failed a call (unknown connection or device, bad argument, driver start failure, ...). code is the gRPC status code name; reason is the server's structured FailureReason, FailureReason.UNSPECIFIED when the failure did not come from the daemon.

code

code

details

details

reason

reason

CommandError

Bases: TapError

A driver command's outcome was error. code is an ErrorCode; detail refines it (e.g. NOT_FOUND/END_REACHED); TRANSPORT_LOST/INDETERMINATE carry the transmission state.

code

code

detail

detail

driver_message

driver_message

operation

operation

serial

serial

selector

selector

request_id

request_id

generation

generation

duration_ms

duration_ms

WaitTimeoutError

Bases: TapError

A condition did not hold within its timeout; the message names the device, the condition and what was observed so a log line alone is diagnosable: reason and match_count for the waits the device runs (visible, one, gone, App.await_visible, App.await_screen_stable), last_observation and polls for the ones the client polls.

description

description

serial

serial

elapsed_ms

elapsed_ms

polls

polls

last_observation

last_observation

reason

reason

Why the device-side condition was still unmet at its last poll; None for client-polled waits.

match_count

match_count

Matches at the last poll of visible / one / gone (capped at 1000).

AppLifecycleError

Bases: TapError

Install/launch/stop did not reach the verified end state.

DeviceBusyError

Bases: TapError

Another session — in this process or any other — holds the device, and wait_for_device was zero or ran out. The device is fine; try later or pick another serial.

DeviceQuarantinedError

Bases: TapError

The device's session journal keeps it out of service (a mutation whose outcome could not be proven, a corrupt journal, an uncertain ADB cleanup). It stays unusable until an explicit reset; retrying or waiting does not help.

serial

serial

ErrorCode

Bases: Enum

Why a driver command failed (CommandError.code). UNKNOWN also stands for a code this client version does not know.

INVALID_REQUEST

INVALID_REQUEST

INVALID_SELECTOR

INVALID_SELECTOR

UNSUPPORTED

UNSUPPORTED

UNAUTHENTICATED

UNAUTHENTICATED

SESSION_MISMATCH

SESSION_MISMATCH

DUPLICATE_OR_STALE

DUPLICATE_OR_STALE

OVERLOADED

OVERLOADED

AUT_MISMATCH

AUT_MISMATCH

NOT_FOUND

NOT_FOUND

AMBIGUOUS

AMBIGUOUS

NOT_INTERACTABLE

NOT_INTERACTABLE

STALE_BEFORE_INPUT

STALE_BEFORE_INPUT

STALE_DURING_COMMAND

STALE_DURING_COMMAND

ACTION_REJECTED

ACTION_REJECTED

WAIT_TIMEOUT

WAIT_TIMEOUT

CANCELLED

CANCELLED

DEADLINE_EXCEEDED

DEADLINE_EXCEEDED

AUT_NOT_INSTALLED

AUT_NOT_INSTALLED

AUT_CRASHED

AUT_CRASHED

AUT_ANR

AUT_ANR

SYNC_PROVIDER_UNAVAILABLE

SYNC_PROVIDER_UNAVAILABLE

DRIVER_UNHEALTHY

DRIVER_UNHEALTHY

TRANSPORT_LOST

TRANSPORT_LOST

INDETERMINATE

INDETERMINATE

ARTIFACT_TRANSFER_FAILED

ARTIFACT_TRANSFER_FAILED

PAYLOAD_TOO_LARGE

PAYLOAD_TOO_LARGE

INTERNAL

INTERNAL

UNKNOWN

UNKNOWN

FailureReason

Bases: Enum

The server's structured reason for a failed call (ServerError.reason). UNSPECIFIED means the failure did not come from the daemon (a transport failure, a proxy, a cancelled call) or carried a reason this client version does not know.

UNSPECIFIED

UNSPECIFIED

INTERNAL

INTERNAL

INVALID_ARGUMENT

INVALID_ARGUMENT

UNAUTHENTICATED

UNAUTHENTICATED

UNKNOWN_CLIENT_CONNECTION

UNKNOWN_CLIENT_CONNECTION

UNKNOWN_ATTACHED_DEVICE

UNKNOWN_ATTACHED_DEVICE

NOT_OWNER

NOT_OWNER

DEVICE_BUSY

DEVICE_BUSY

DEVICE_QUARANTINED

DEVICE_QUARANTINED

HOST_WAIT_TIMEOUT

HOST_WAIT_TIMEOUT

ADB_TIMEOUT

ADB_TIMEOUT

ADB_FAILED

ADB_FAILED

ADB_REAP_UNCERTAIN

ADB_REAP_UNCERTAIN

APP_LIFECYCLE

APP_LIFECYCLE

DRIVER_BUILD_MISMATCH

DRIVER_BUILD_MISMATCH

DRIVER_START_FAILED

DRIVER_START_FAILED

DRIVER_TRANSPORT

DRIVER_TRANSPORT

DRIVER_COMMAND

DRIVER_COMMAND

SESSION_UNUSABLE

SESSION_UNUSABLE

DAEMON_PRECONDITION

DAEMON_PRECONDITION

UNKNOWN_REF

UNKNOWN_REF

REF_NOT_ADDRESSABLE

REF_NOT_ADDRESSABLE

UNSUPPORTED_API

UNSUPPORTED_API

The device's API level is too low for the call (detail REQUIRES_API_<n>).

DEVICE_SETTING

DEVICE_SETTING

A device setting did not read back as written (or could not be restored).

DEVICE_FILE

DEVICE_FILE

A device file was not written or read as asked: it exists and this device handle did not create it, its directory is missing, it is not a regular file, or it did not read back.

WaitReason

Bases: Enum

Why a device-side wait timed out (WaitTimeoutError.reason).

NO_MATCH

NO_MATCH

visible / one: nothing matched.

AMBIGUOUS

AMBIGUOUS

one: several nodes matched (WaitTimeoutError.match_count says how many).

STILL_PRESENT

STILL_PRESENT

gone: the selector still matched.

SCREEN_CHANGING

SCREEN_CHANGING

await_screen_stable: the screen kept changing.

APP_NOT_VISIBLE

APP_NOT_VISIBLE

App.await_visible / App.await_screen_stable: the package never owned the focused window.

NO_PERMISSION_PROMPT

NO_PERMISSION_PROMPT

await_permission_prompt: no runtime-permission dialog showed a known choice.

NO_TOAST

NO_TOAST

await_toast: no matching toast was shown.

NO_NOTIFICATION

NO_NOTIFICATION

await_notification: no matching notification was active.