Skip to content

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 ​

CodeMeaningDocs
AMBIGUOUS_KEYBOARDapp.keyboard found several declared keyboards on screen and none holds focus.text-input
APP_NOT_LAUNCHEDapp.openDeepLink before app.launch: there is no running app to deliver the link to.deep-links
CAPABILITY_MISSINGThe action or assertion needs a capability this target does not have (driver, SDK domain or mock server).capabilities
CHAR_NOT_ON_KEYBOARDAn app keyboard has no key for a character on any layer its declared toggles reach.text-input
DEEPLINK_INVALIDA 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_FAILEDA command device provider command failed.test/devices
DEVICE_COMMAND_OUTPUTThe device acquire command must print JSON with an "address" on its last line; got.test/devices
DRIVER_CONTRACTA driver returned something that breaks the Driver contract (a driver bug).drivers, capabilities
DUPLICATE_KEYBOARDTwo keyboards in the keyboards option share a name.text-input
ELEMENT_DETACHEDThe element a locator resolved to left the screen before it could be read.text-snapshots
ELEMENT_NOT_FOUNDA locator matched no element within the timeout.focus-navigation, text-input, locators
ELEMENT_OFFSCREENCannot screenshot an element outside the viewport.screenshots
FOCUS_LOOPpressUntilFocused: focus came back to an element it already left (a wrap-around).focus-navigation
FOCUS_STUCKpressUntilFocused: a press did not move focus within navigationSettleMs.focus-navigation
FOCUS_UNCHANGEDFocus stayed on … for …ms after the action.focus-navigation
FOCUS_UNREACHABLEpressUntilFocused or navigateTo gave up: maxPresses presses, or no direction left to try.focus-navigation
INVALID_ARGUMENTAn 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_DRIVERThe configured driver module does not default-export a matching DriverModule.test/config
INVALID_SCREENSHOTNot a toets screenshot.screenshots
INVALID_SUBJECTA matcher received a subject it does not support. Also in @toets/test.assertions
KEY_UNSUPPORTEDThe platform's remote has no such key, or cannot hold keys.remote
KEYBOARD_ACTION_MISSINGA text action needs a key (backspace, clear, submit) the keyboard does not declare or show.text-input
MOCK_DISABLEDNetwork mocking is not enabled for this project.network
MOCK_UNAVAILABLENetwork mocking is on, but no mock server is set.network
MODULE_NOT_FOUNDCannot find … (…).test/config
NO_DEVICESNo device addresses were configured for external devices.test/devices
NO_FOCUSNothing holds focus, before moving focus or after a press.focus-navigation
NO_KEYBOARDNo 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_DEVICESThe driver cannot manage devices for this platform.test/devices
NOT_EDITABLEtoHaveValue on an element that is not a system text field.text-input
NOT_ENOUGH_DEVICESThere are fewer external devices than workers.test/devices
SDK_NOT_CONNECTEDThe app did not connect to the toets SDK host at … within …ms.sdk
SECURE_FIELDtoHaveValue on a secure (password) field, whose value is masked.text-input
STRICT_MODE_VIOLATIONA locator matched several elements where exactly one is needed.locators
TEXT_NOT_ENTEREDAfter typing, the field does not show exactly the text.text-input
UNKNOWN_KEYUnknown key ….remote

@toets/test ​

CodeMeaningDocs
NEGATION_UNSUPPORTEDThe matcher cannot be negated with .not.assertions
NOT_A_TOETS_PROJECTProject "…" is not a toets project.test/config

@toets/driver-web ​

CodeMeaningDocs
WEB_ELEMENT_OFFSCREENThe element is outside the viewport.
WEB_EVALUATE_FAILEDReading the page failed.
WEB_INVALID_CONFIGThe web app config or webDriver() options are malformed (url, keys, ...).driver-web/keys, driver-web/options
WEB_KEY_UNMAPPEDKey … has no web key mapping.driver-web/keys
WEB_LAUNCH_FAILEDCould not load the app at ….driver-web/setup
WEB_NO_DOCUMENTThe page has no document element to read.
WEB_NO_TEXT_FIELDSystem text entry on web found no text field holding focus in the page.text-input
WEB_NOT_CHROMIUMThe web driver needs a Chromium page.driver-web/setup
WEB_NOT_RECORDINGNo recording is running.
WEB_NOT_STARTEDThe web driver is not started.
WEB_PAGE_CLOSEDThe page passed to the web driver is closed.driver-web/setup
WEB_RECORDING_ACTIVEA recording is already running.
WEB_STALE_ELEMENTThe element is no longer in the document.
WEB_START_FAILEDCould not open a browser page.driver-web/setup

@toets/driver-android-tv ​

CodeMeaningDocs
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_FAILEDAppium did not start on port ….driver-android-tv/setup
ANDROID_AVD_FAILEDCreating 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_DETACHEDThe element is no longer on screen.driver-android-tv/traps
ANDROID_EMULATOR_FAILEDNo free emulator port from … to ….driver-android-tv/devices
ANDROID_KEY_UNSUPPORTEDKey … is not available on the '…' remote.driver-android-tv/keys
ANDROID_LAUNCH_FAILEDLaunching … failed.driver-android-tv/setup
ANDROID_NO_DEVICENo Android device to run on.driver-android-tv/devices
ANDROID_NO_TEXT_FIELDSystem 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_STARTEDThe Android TV driver is not started.
ANDROID_RECORDING_FAILEDstopRecording() called without a recording.
ANDROID_SDK_NOT_FOUNDAndroid SDK not found.driver-android-tv/setup
ANDROID_SESSION_FAILEDCould not open a UiAutomator2 session on ….driver-android-tv/setup
ANDROID_SYSTEM_IMAGE_MISSINGNo … system image for API … (…) is installed.driver-android-tv/devices
DEEPLINK_UNHANDLEDNo 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 ​

CodeMeaningDocs
TVOS_APP_NOT_INSTALLED… is not installed on simulator ….driver-tvos/setup
TVOS_APPIUM_START_FAILEDAppium did not start on ….driver-tvos/setup
TVOS_BOOT_FAILEDSimulator … did not boot.driver-tvos/simulators
TVOS_COMMAND_FAILEDOpening … failed.driver-tvos/traps, driver-tvos/capabilities
TVOS_CONFIGmanaged.namePrefix "…" does not start with "toets".driver-tvos/simulators, driver-tvos/setup
TVOS_DEVICE_TYPE_MISSINGThe requested Apple TV device type is not available for the tvOS runtime.driver-tvos/simulators
TVOS_ELEMENT_DETACHEDElement … is no longer on screen.driver-tvos/traps
TVOS_ELEMENT_NOT_VISIBLEElement … is not visible on screen.driver-tvos/traps
TVOS_KEY_UNSUPPORTEDThe Siri Remote has no button for ….driver-tvos/remote
TVOS_NO_DEVICENo tvOS simulator to drive.driver-tvos/simulators
TVOS_NO_TEXT_FIELDSystem text entry on tvOS found no focused text field.driver-tvos/capabilities
TVOS_NOT_A_TVOS_SIMULATORSimulator … (…) runs …, not tvOS.driver-tvos/simulators
TVOS_NOT_STARTEDThe tvOS driver is not started.
TVOS_RECORDING_FAILEDA recording is already running.driver-tvos/capabilities
TVOS_RUNTIME_MISSINGNo installed tvOS simulator runtime.driver-tvos/simulators
TVOS_SESSION_FAILEDCould not open an Appium XCUITest session on ….driver-tvos/setup
TVOS_SIMCTL_FAILEDxcrun … failed (exit …).driver-tvos/simulators
TVOS_SIMULATOR_NOT_FOUNDNo simulator with UDID … in ….driver-tvos/simulators
TVOS_WDA_BUILD_FAILEDBuilding WebDriverAgent for tvOS Simulator failed (exit …).driver-tvos/setup

@toets/mock ​

CodeMeaningDocs
MOCK_BAD_ORIGINThe origin header is not an http(s) origin.mock/app-integration
MOCK_BAD_REQUESTThe request could not be turned into a Fetch Request (e.g. unsupported method).mock/concepts
MOCK_CLIENT_ABORTEDThe app closed the connection before the response completed.
MOCK_HANDLER_ERRORA handler threw.mock/writing-handlers
MOCK_INTERNAL_ERRORAn unexpected failure inside the mock server (a toets bug: please report it).mock/concepts
MOCK_INVALID_HANDLERuse() / resetHandlers() received something that is not an MSW request handler.mock/writing-handlers
MOCK_INVALID_OPTIONAn option passed to createMockServer(), latency() or failure() is invalid.mock/writing-handlers
MOCK_LISTEN_FAILEDThe server could not start listening for another reason.mock/concepts
MOCK_NETWORK_ERRORA handler returned HttpResponse.error(): the connection is dropped on purpose.
MOCK_NO_ORIGINNo handler matched and the request has no origin header, so there is nowhere to proxy.mock/app-integration
MOCK_PORT_IN_USEThe requested port is taken.mock/concepts
MOCK_RESPONSE_FAILEDThe response body failed after headers were sent (upstream reset, broken mock stream).
MOCK_UNHANDLEDNo handler matched and the server runs with onUnhandledRequest: 'reject'.mock/writing-handlers
MOCK_UPSTREAM_UNREACHABLEProxying to the real upstream failed before a response arrived.mock/concepts

@toets/protocol ​

CodeMeaningDocs
sdk.closedThe session closed (app quit, crashed or reloaded) before the request completed.protocol/host
sdk.host-closedThe host was closed while waiting or requesting.protocol/host
sdk.listen-failedThe host could not open its WebSocket server.protocol/host
sdk.method-unsupportedThe SDK did not announce the domain, or its protocol version predates the method.protocol/spec
sdk.remote-errorThe SDK answered with an error. rpcCode and data carry the details.
sdk.request-timeoutThe app did not answer a request in time.protocol/host
sdk.session-timeoutThe app did not complete the handshake in time.protocol/host
sdk.unknown-tokenwaitForSession was called with a token this host never issued (or that expired).protocol/host

@toets/mcp ​

CodeMeaningDocs
MCP_BAD_INPUTA target needs testId and/or text.mcp/tools
MCP_CONFIG_INVALIDInvalid toets MCP ….mcp/setup
MCP_CONFIG_NOT_FOUNDConfig not found at ….mcp/setup
MCP_NO_CONFIGNo toets config, so there is no target to drive.mcp/setup
MCP_NOT_LAUNCHEDThe app is not running yet.mcp/tools
MCP_UNKNOWN_TARGETUnknown target "…".mcp/setup