Error codes
Every toets error has a stable code. In test output it reads ToetsError: [CODE] message, followed by Hint: (likely cause and fix) and Docs: (the page to read). Act on the hint first; branch on the code, never on the message.
A Docs: path of the form reference/<package>/docs/<page> ships with that package at node_modules/@toets/<package>/docs/<page>.md; other paths (concepts/focus) are pages of the docs site.
Codes from the SDK host (sdk.*) surface as ToetsError with the same code.
@toets/core
| Code | Meaning | Docs |
|---|---|---|
AMBIGUOUS_KEYBOARD | app.keyboard found several declared keyboards on screen and none holds focus. | text-input |
APP_NOT_LAUNCHED | app.openDeepLink before app.launch: there is no running app to deliver the link to. | deep-links |
CAPABILITY_MISSING | The action or assertion needs a capability this target does not have (driver, SDK domain or mock server). | capabilities |
CHAR_NOT_ON_KEYBOARD | An app keyboard has no key for a character on any layer its declared toggles reach. | text-input |
DEEPLINK_INVALID | A deep link is not an absolute URL, or the platform's deepLink mapper threw or returned something the platform can not open. Also in @toets/driver-android-tv, @toets/driver-tvos, @toets/driver-web. | deep-links |
DEVICE_COMMAND_FAILED | A command device provider command failed. | test/devices |
DEVICE_COMMAND_OUTPUT | The device acquire command must print JSON with an "address" on its last line; got. | test/devices |
DRIVER_CONTRACT | A driver returned something that breaks the Driver contract (a driver bug). | drivers, capabilities |
DUPLICATE_KEYBOARD | Two keyboards in the keyboards option share a name. | text-input |
ELEMENT_DETACHED | The element a locator resolved to left the screen before it could be read. | text-snapshots |
ELEMENT_NOT_FOUND | A locator matched no element within the timeout. | focus-navigation, text-input, locators |
ELEMENT_OFFSCREEN | Cannot screenshot an element outside the viewport. | screenshots |
FOCUS_LOOP | pressUntilFocused: focus came back to an element it already left (a wrap-around). | focus-navigation |
FOCUS_STUCK | pressUntilFocused: a press did not move focus within navigationSettleMs. | focus-navigation |
FOCUS_UNCHANGED | Focus stayed on … for …ms after the action. | focus-navigation |
FOCUS_UNREACHABLE | pressUntilFocused or navigateTo gave up: maxPresses presses, or no direction left to try. | focus-navigation |
INVALID_ARGUMENT | An API received an invalid argument, such as a value that is not a toets Locator or a negative count. | screenshots, focus-navigation, text-input, locators, assertions, remote |
INVALID_DRIVER | The configured driver module does not default-export a matching DriverModule. | test/config |
INVALID_SCREENSHOT | Not a toets screenshot. | screenshots |
INVALID_SUBJECT | A matcher received a subject it does not support. Also in @toets/test. | assertions |
KEY_UNSUPPORTED | The platform's remote has no such key, or cannot hold keys. | remote |
KEYBOARD_ACTION_MISSING | A text action needs a key (backspace, clear, submit) the keyboard does not declare or show. | text-input |
MOCK_DISABLED | Network mocking is not enabled for this project. | network |
MOCK_UNAVAILABLE | Network mocking is on, but no mock server is set. | network |
MODULE_NOT_FOUND | Cannot find … (…). | test/config |
NO_DEVICES | No device addresses were configured for external devices. | test/devices |
NO_FOCUS | Nothing holds focus, before moving focus or after a press. | focus-navigation |
NO_KEYBOARD | No keyboard for the field: it is no system text field and no declared keyboard lists it, or the declared keyboard did not open. | text-input |
NO_MANAGED_DEVICES | The driver cannot manage devices for this platform. | test/devices |
NOT_EDITABLE | toHaveValue on an element that is not a system text field. | text-input |
NOT_ENOUGH_DEVICES | There are fewer external devices than workers. | test/devices |
SDK_NOT_CONNECTED | The app did not connect to the toets SDK host at … within …ms. | sdk |
SECURE_FIELD | toHaveValue on a secure (password) field, whose value is masked. | text-input |
STRICT_MODE_VIOLATION | A locator matched several elements where exactly one is needed. | locators |
TEXT_NOT_ENTERED | After typing, the field does not show exactly the text. | text-input |
UNKNOWN_KEY | Unknown key …. | remote |
@toets/test
| Code | Meaning | Docs |
|---|---|---|
NEGATION_UNSUPPORTED | The matcher cannot be negated with .not. | assertions |
NOT_A_TOETS_PROJECT | Project "…" is not a toets project. | test/config |
@toets/driver-web
| Code | Meaning | Docs |
|---|---|---|
WEB_ELEMENT_OFFSCREEN | The element is outside the viewport. | |
WEB_EVALUATE_FAILED | Reading the page failed. | |
WEB_INVALID_CONFIG | The web app config or webDriver() options are malformed (url, keys, ...). | driver-web/keys, driver-web/options |
WEB_KEY_UNMAPPED | Key … has no web key mapping. | driver-web/keys |
WEB_LAUNCH_FAILED | Could not load the app at …. | driver-web/setup |
WEB_NO_DOCUMENT | The page has no document element to read. | |
WEB_NO_TEXT_FIELD | System text entry on web found no text field holding focus in the page. | text-input |
WEB_NOT_CHROMIUM | The web driver needs a Chromium page. | driver-web/setup |
WEB_NOT_RECORDING | No recording is running. | |
WEB_NOT_STARTED | The web driver is not started. | |
WEB_PAGE_CLOSED | The page passed to the web driver is closed. | driver-web/setup |
WEB_RECORDING_ACTIVE | A recording is already running. | |
WEB_STALE_ELEMENT | The element is no longer in the document. | |
WEB_START_FAILED | Could not open a browser page. | driver-web/setup |
@toets/driver-android-tv
| Code | Meaning | Docs |
|---|---|---|
ANDROID_APP_CONFIG | … has no launcher activity (LEANBACK_LAUNCHER or LAUNCHER). | driver-android-tv/setup |
ANDROID_APP_NOT_INSTALLED | … is not installed on …. | driver-android-tv/setup |
ANDROID_APPIUM_START_FAILED | Appium did not start on port …. | driver-android-tv/setup |
ANDROID_AVD_FAILED | Creating AVD … failed. | driver-android-tv/devices |
ANDROID_COMMAND_FAILED | … failed (exit …). | driver-android-tv/devices, driver-android-tv/setup |
ANDROID_COMMAND_TIMEOUT | … did not finish within …ms. | |
ANDROID_DEVICE_NOT_READY | … did not finish booting within …ms. | driver-android-tv/devices |
ANDROID_ELEMENT_DETACHED | The element is no longer on screen. | driver-android-tv/traps |
ANDROID_EMULATOR_FAILED | No free emulator port from … to …. | driver-android-tv/devices |
ANDROID_KEY_UNSUPPORTED | Key … is not available on the '…' remote. | driver-android-tv/keys |
ANDROID_LAUNCH_FAILED | Launching … failed. | driver-android-tv/setup |
ANDROID_NO_DEVICE | No Android device to run on. | driver-android-tv/devices |
ANDROID_NO_TEXT_FIELD | System text entry found no focused field (fill, app.keyboard on a system field). | driver-android-tv/capabilities |
ANDROID_NOT_A_TV | … is not an Android TV device. | driver-android-tv/devices |
ANDROID_NOT_STARTED | The Android TV driver is not started. | |
ANDROID_RECORDING_FAILED | stopRecording() called without a recording. | |
ANDROID_SDK_NOT_FOUND | Android SDK not found. | driver-android-tv/setup |
ANDROID_SESSION_FAILED | Could not open a UiAutomator2 session on …. | driver-android-tv/setup |
ANDROID_SYSTEM_IMAGE_MISSING | No … system image for API … (…) is installed. | driver-android-tv/devices |
DEEPLINK_UNHANDLED | No activity, registered URL scheme or served page of the app handles the translated deep link. Also in @toets/driver-tvos, @toets/driver-web. | deep-links |
@toets/driver-tvos
| Code | Meaning | Docs |
|---|---|---|
TVOS_APP_NOT_INSTALLED | … is not installed on simulator …. | driver-tvos/setup |
TVOS_APPIUM_START_FAILED | Appium did not start on …. | driver-tvos/setup |
TVOS_BOOT_FAILED | Simulator … did not boot. | driver-tvos/simulators |
TVOS_COMMAND_FAILED | Opening … failed. | driver-tvos/traps, driver-tvos/capabilities |
TVOS_CONFIG | managed.namePrefix "…" does not start with "toets". | driver-tvos/simulators, driver-tvos/setup |
TVOS_DEVICE_TYPE_MISSING | The requested Apple TV device type is not available for the tvOS runtime. | driver-tvos/simulators |
TVOS_ELEMENT_DETACHED | Element … is no longer on screen. | driver-tvos/traps |
TVOS_ELEMENT_NOT_VISIBLE | Element … is not visible on screen. | driver-tvos/traps |
TVOS_KEY_UNSUPPORTED | The Siri Remote has no button for …. | driver-tvos/remote |
TVOS_NO_DEVICE | No tvOS simulator to drive. | driver-tvos/simulators |
TVOS_NO_TEXT_FIELD | System text entry on tvOS found no focused text field. | driver-tvos/capabilities |
TVOS_NOT_A_TVOS_SIMULATOR | Simulator … (…) runs …, not tvOS. | driver-tvos/simulators |
TVOS_NOT_STARTED | The tvOS driver is not started. | |
TVOS_RECORDING_FAILED | A recording is already running. | driver-tvos/capabilities |
TVOS_RUNTIME_MISSING | No installed tvOS simulator runtime. | driver-tvos/simulators |
TVOS_SESSION_FAILED | Could not open an Appium XCUITest session on …. | driver-tvos/setup |
TVOS_SIMCTL_FAILED | xcrun … failed (exit …). | driver-tvos/simulators |
TVOS_SIMULATOR_NOT_FOUND | No simulator with UDID … in …. | driver-tvos/simulators |
TVOS_WDA_BUILD_FAILED | Building WebDriverAgent for tvOS Simulator failed (exit …). | driver-tvos/setup |
@toets/mock
| Code | Meaning | Docs |
|---|---|---|
MOCK_BAD_ORIGIN | The origin header is not an http(s) origin. | mock/app-integration |
MOCK_BAD_REQUEST | The request could not be turned into a Fetch Request (e.g. unsupported method). | mock/concepts |
MOCK_CLIENT_ABORTED | The app closed the connection before the response completed. | |
MOCK_HANDLER_ERROR | A handler threw. | mock/writing-handlers |
MOCK_INTERNAL_ERROR | An unexpected failure inside the mock server (a toets bug: please report it). | mock/concepts |
MOCK_INVALID_HANDLER | use() / resetHandlers() received something that is not an MSW request handler. | mock/writing-handlers |
MOCK_INVALID_OPTION | An option passed to createMockServer(), latency() or failure() is invalid. | mock/writing-handlers |
MOCK_LISTEN_FAILED | The server could not start listening for another reason. | mock/concepts |
MOCK_NETWORK_ERROR | A handler returned HttpResponse.error(): the connection is dropped on purpose. | |
MOCK_NO_ORIGIN | No handler matched and the request has no origin header, so there is nowhere to proxy. | mock/app-integration |
MOCK_PORT_IN_USE | The requested port is taken. | mock/concepts |
MOCK_RESPONSE_FAILED | The response body failed after headers were sent (upstream reset, broken mock stream). | |
MOCK_UNHANDLED | No handler matched and the server runs with onUnhandledRequest: 'reject'. | mock/writing-handlers |
MOCK_UPSTREAM_UNREACHABLE | Proxying to the real upstream failed before a response arrived. | mock/concepts |
@toets/protocol
| Code | Meaning | Docs |
|---|---|---|
sdk.closed | The session closed (app quit, crashed or reloaded) before the request completed. | protocol/host |
sdk.host-closed | The host was closed while waiting or requesting. | protocol/host |
sdk.listen-failed | The host could not open its WebSocket server. | protocol/host |
sdk.method-unsupported | The SDK did not announce the domain, or its protocol version predates the method. | protocol/spec |
sdk.remote-error | The SDK answered with an error. rpcCode and data carry the details. | |
sdk.request-timeout | The app did not answer a request in time. | protocol/host |
sdk.session-timeout | The app did not complete the handshake in time. | protocol/host |
sdk.unknown-token | waitForSession was called with a token this host never issued (or that expired). | protocol/host |
@toets/mcp
| Code | Meaning | Docs |
|---|---|---|
MCP_BAD_INPUT | A target needs testId and/or text. | mcp/tools |
MCP_CONFIG_INVALID | Invalid toets MCP …. | mcp/setup |
MCP_CONFIG_NOT_FOUND | Config not found at …. | mcp/setup |
MCP_NO_CONFIG | No toets config, so there is no target to drive. | mcp/setup |
MCP_NOT_LAUNCHED | The app is not running yet. | mcp/tools |
MCP_UNKNOWN_TARGET | Unknown target "…". | mcp/setup |