MONKEYTESTERDOCS
Docs / Reference

Troubleshooting

Known failure modes and their fixes, from every repo's README. When unsure, open the viewer's /api/status first: it reports every dependency's state.

First check

curl -s http://192.168.125.70:8089/api/status | python3 -m json.tool

Each of controller, vision, plugins carries its own ok and the URL it used. Fix the first one that is wrong, bottom-up: the service itself, then the viewer's Settings entry.

Viewer and runs

SymptomWhat to do
Run fails: controller unreachable / device not connectedStart the Mobile Controller on the Mac first. A device id must be an adb serial or iPhone UDID the controller currently serves; check run_on_device.py --list-devices.
SCRIPT step calling adb failsSCRIPT and DIAGNOSE run on the MonkeyTester host (Linux), where adb isn't available. Drive the phone with test steps, or run adb on the Mac outside the test.
iPhone black-screens every captureThe phone is locked. Passcode/Face ID can't be sent by WDA. Keep it unlocked and awake; the runner refuses to start and the unlock action reports it.
iOS app data survives restartsThere is no pm clear on iOS. Use REINSTALL_APP: true in the case's INSTRUCTION.txt or an UNINSTALL step.
Run shows Error, was runningThe stale-run watchdog stamped it interrupted (no filesystem activity for MT_STALE_RUN_SECS): a host shutdown, SIGKILL or a viewer restart. The build's run then reads as failed.
"Gave up after 300s waiting for an iPhone to connect"No device of that platform was connected when the run's turn came. Connect it (trusted, unlocked) or raise MT_DEVICE_CONNECT_WAIT_SECS.
Zero tests / wrong casesEvery mt-tests/<case>/ needs an INSTRUCTION.txt and a test .txt; the check fails on zero tests.
Build conclusion success but the run failed anywaysuccess means the apps were uploaded — the run's own verdict decides: a recording run (record-snapshots mode) counts as a failure; passed needs a completed run, runner exit 0, at least one test and no failures.

Mobile Controller (Mac)

SymptomWhat to do
First iOS session hangs for minutesNormal: WebDriverAgent is being built and signed onto the phone. Watch /tmp/monkeytester-mobile-controller.log.
iOS fails at signing from the LaunchAgentThe signing identity must be unlocked in the login keychain for that agent — run security find-identity -v -p codesigning, and when macOS asks for keychain access choose Always Allow. Check the team ID.
Wireless Android phone not listedPairing is per host: it must be paired with the Mac. Pair via the controller's adb, or list it in ADB_CONNECT.
adb missing on the MacThe controller looks in ANDROID_HOME (default ~/Library/Android/sdk/platform-tools) or ADB_BIN. Install the SDK there or point at the binary.
iOS recording fails (/record)The XCUITest recorder is an insecure driver feature: the controller spawns Appium with --allow-insecure xcuitest:xctest_screen_record. If you run Appium yourself (APPIUM_URL), start it with that flag.
Two controllers on one MacUnload the other's LaunchAgent. Ports won't clash, but both would control the same phones.

Vision model (MonkeyTester-Plugin-AI)

SymptomFix
Ollama is not installed / model missingRun bin/monkeytester-ai setup.
Port 11435 already in useA previous run is alive: lsof -i :11435, stop it, or set MTAI_OLLAMA_PORT.
Address already in use (8091)Something holds the port (often the old login service). Check status, or set MTAI_PORT.
401 from ask or the viewerToken mismatch: the panel's pairing token must equal the service's MTAI_TOKEN.
503 model backend unavailableOllama down/restarting — .runtime/logs/ollama.log.
503 GitHub Copilot is not signed inSign in again in the panel, or switch to Local.
Copilot 401/403 upstream_errorGitHub refused the sign-in (subscription ended, token revoked, editor API changed). Remove and sign in again; Local is unaffected.
could not reach <address>/v1/modelsRemote server off, address wrong, or not OpenAI-compatible — curl <address>/v1/models from the Mac.
the remote server rejected the API keyThe server needs --api-key and none/wrong key set. Replace it.
Viewer Test times outIt waits 15 s; the model reloads after 30 min idle. Retry and check status shows the model loaded.
Other machines can't connectConfirm --lan was used and the macOS firewall allows incoming connections for Python.
Digest error at setupOllama republished the model; if you trust the new version, update the pin in monkeytester_ai/config.py.
Slow answers / swappingClose memory-heavy apps (Xcode), or use the 3B model.
Taps land in the wrong placeRun the ask check on tests/fixtures/target.png. If that answers right, the problem is that screen — describe it more specifically.

Build & Test and the build plugin

SymptomWhat to do
Build ends failure without any device being touchedThe fetch or the code host failed: no code host token saved → 409 not_configured; the code host unreachable or refusing → forge_unreachable / forge_refused (its HTTP status comes as forge_status); unknown branch → 404 not_found. The Settings ✗ per project names the reason. For GitHub the code host URL is the web address — https://github.com or https://<host> for Enterprise — and the token must at least read the repo.
A platform is greyed out in Build & TestThe plugin can't build it: it detects Xcode (ios) and an Android SDK (android) at start — a Linux host only offers Android. GET /health lists the platforms; BUILD_LOCAL_PLATFORMS can force a subset.
iPhone tests Unavailable in an otherwise-green runThe IPA didn't build (usually signing): the plugin uploaded that platform as a build error (--ios-build-error + --ios-build-log in its submit step), so the run still fails. Fix signing — provisioning profile must include the iPhone's UDID, no simulator builds, and the signing identity must be unlocked in the login keychain of the user the plugin's agent runs as.
Build stays queuedBuilds run one at a time (FIFO): an earlier build is still running — its /health queue block names it. Cancel a queued or running build from Build & Test (the plugin terminates the script's whole process group) and watch GET /builds/<ref>/log.
Upload refused with 401After the security update uploads need the CI token: generate one in Settings (Generate new CI token, shown once) and store it as the app repo's MT_CI_TOKEN secret. A newly generated token replaces the old one. See Build & Test → The CI token.
A service exits at start about a missing tokenIt is bound to a non-loopback address without a token, which every service refuses after the security update. Set its token (e.g. CONTROLLER_TOKEN, PLUGIN_TOKEN, MTAI_TOKEN) or bind it to 127.0.0.1. See Security.
The viewer only shows a login pageLogin is always required. On first start the only account is admin / admin — sign in and change its password; other people get accounts from the admin on Settings → Users.
Viewer upgraded from the old built-in Gitea clientOne-time migration, automatic: gitea_config.json becomes the build-local plugin at MT_BUILD_LOCAL_URL (default http://127.0.0.1:8094) plus one project per saved repo; the first time that plugin reports its code host not configured, the viewer sends the saved URL and token to its POST /config once. On success gitea_config.json is rewritten without the token and renamed gitea_config.json.migrated. MT_BUILD_PLUGINS=name=url[,…] is imported the same way, once.