You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android leases time out with no reason when the emulator rejects -crash-report-mode (Emulator 36.1.9) #1199
With Android Emulator 36.1.9, every Android lease waited about three minutes and then failed:
$ simlock lease --platform android --device "Pixel 9" --detach --ttl 10m --timeout 6m
{"push":"progress","stage":"provisioning","etaMs":1000}
{"push":"progress","stage":"booting","etaMs":70000}
{"error":{"code":"INTERNAL","message":"Timed out waiting for device to boot: dev_0a628b60-efcd-49b2-a23f-aea62103186c"}}
No emulator process ever appeared while the lease waited, and simlock doctor reported no findings.
To find out why, I copied the AVD that Simlock created during a lease and started it myself with the same arguments. The emulator stopped at once:
INFO | Android emulator version 36.1.9.0 (build_id 13823996) (CL:N/A)
INFO | Graphics backend: gfxstream
INFO | Found systemPath /Users/<me>/Library/Android/sdk/system-images/android-36/google_apis_playstore/arm64-v8a/
unknown option: -crash-report-mode
please use -help for a list of valid options
After updating the emulator to 37.2.13 (sdkmanager --install emulator) and restarting the daemon, leases boot normally.
What you expected
Simlock to say that the installed emulator can't be used, for example in the lease error or in simlock doctor, instead of a boot timeout with no reason. A boot that can never succeed shouldn't take the full boot timeout to fail either.
How to reproduce
Install Android Emulator 36.1.9 (the version Android Studio installed here until recently).
{"level":"warn","module":"daemon.device-provisioner","message":"new device failed to become ready","fields":{"deviceId":"dev_bee0f4d1-1613-4f06-9331-5bff0692e2a2","step":"boot","error":"BootTimeoutError: Timed out waiting for device to boot: simlock_5692ecb6-ae11-46c0-98ec-f3b9c075d58a"}}
{"level":"error","module":"daemon.server.dispatch","message":"operation","fields":{"operation":"lease.request","role":"agent","durationMs":182578,"code":"INTERNAL","message":"Timed out waiting for device to boot: dev_bee0f4d1-1613-4f06-9331-5bff0692e2a2"}}
emulator -help on 36.1.9 doesn't list -crash-report-mode; on 37.2.13 it does.
Automated triage. I read the code only. I wrote no failing test and pushed no bug/1199-repro branch, because this routine changes no code. A maintainer or the triage-bug flow still needs to add that test.
Classification: Android bug, a regression in 0.5.0. Labelled platform:android. It stays bug:new. Moving it to bug:ready is a maintainer call.
Gap. That is why the lease waits the full timeout. The emulator is spawned with stdio: "ignore", and #waitForReadiness (src/drivers/android/index.ts:2126) only polls adb getprop until BootTimeoutError. It never notices that the process has already exited, and it has no stderr to report. simlock doctor has no check for the emulator version either.
Simplest fix (proposal). Pass -crash-report-mode only when the emulator supports it: a version check, or a one-time emulator -help probe. Also, fail the boot as soon as the spawned emulator exits, with an error that quotes its stderr tail. Deciding on a minimum supported emulator version (a doctor finding) is left to the maintainer.
A boot-fails-on-exit check must not break adoption of running emulators after a daemon restart.
Duplicates / related: no duplicate found. Related: #1183 (closed, the bug whose fix introduced this flag) and #1186 (that fix).
Missing info: none needed. It would still help to know the oldest emulator version that accepts -crash-report-mode. The report shows only that 36.1.9 rejects it and 37.2.13 accepts it.
Confirmed. Gap: the boot wait never watches the emulator process, so an exit at launch costs 180 s and no reason. The expectation is a proposal.
src/drivers/android/index.test.ts:769, "fails the boot as soon as the emulator exits, naming the emulator's own error line", on bug/1199-repro (d90473c). The fake emulator prints the issue's 36.1.9 lines and exits 1; the clock never moves.
pnpm exec vitest run --project unit src/drivers/android/index.test.ts -t "naming the emulator's own error line"
AssertionError: still waiting for the boot after the emulator exited: expected undefined to match object { message: StringContaining "unknown option: -crash-report-mode" }
# this host, emulator 36.5.11 (-help runs in 26 ms)
$ emulator -help | grep crash-report
-crash-report-mode <option list> Override crash reporting mode. Available options: disabled, never, always, ask
Root cause
src/drivers/android/index.ts:2282 passes -crash-report-mode never (#1186) to every emulator; 36.1.9 rejects it. The wait is the gap: #startEmulator (:2270) spawns with stdio: "ignore", and #waitForReadiness (:2126) polls only adb until the timeout, never handle.wait(). Then src/core/device-provisioner.ts:142 replaces any driver reason with "Timed out waiting for device to boot" (#1229).
Maintainer decision (relayed by an agent): fix as the triage report recommends — items 1 (fail fast on emulator exit with its own log lines), 2 (doctor check from emulator -help for every flag Simlock always passes) and 3 (emulator requirement in requirements.mdx). No flag-only-when-supported fallback, no pinned minimum version.
Scope also includes #1229's fix, since item 1 is invisible without it: DeviceProvisioner keeps BootTimeoutError (reason boot-timeout) but carries the driver's message instead of replacing it.
Land before #1205, which rewrites the Android boot.
Fix spec (maintainer decision, relayed by an agent)
This supersedes the earlier automated triage's "pass the flag only when supported" proposal.
Tests
src/drivers/android/index.test.ts: fails the boot as soon as the emulator exits, naming the emulator's own error line (triage test on bug/1199-repro, d90473c): no wait for the boot timeout; the error is a DriverCrashError carrying the last lines of the emulator's log.
src/drivers/android/index.test.ts: the emulator's output goes to <avd folder>/emulator.log, mode 0600, truncated at each start; adopting a running emulator after a daemon restart and the taken-console-port cases behave as today.
Android prerequisites test: emulator -help lacking a flag Simlock always passes (e.g. -crash-report-mode) gives a doctor finding naming the flag and the fix sdkmanager --install emulator; an emulator listing every flag gives none.
Done when
An Android lease whose emulator exits at launch fails at once, and the lease error quotes the emulator's own error line (e.g. unknown option: -crash-report-mode).
Question: when an existing shut-down device fails to boot (bootShutdown, src/leasing/lease-acquisition-coordinator.ts:1197), does the requester get the driver's message too? The fix spec's Tests name only the new-device path (device-provisioner).
Taken: yes. That path rejects BootTimeoutError (reason boot-timeout) carrying the driver's message, as the provisioner path does. Done when line 2 ("a boot failure the driver reports with a reason reaches the requester with that reason") covers every boot, and without it a second lease of the same Pixel 9 would still time out with no reason.
Tests: src/leasing/ coordinator test: a shut-down device whose driver fails to boot gives the requester BootTimeoutError (reason boot-timeout) carrying the driver's message.
Merged: #1232 (#1199)
Parked: none
Waiting: none
Decided: #1199 — does a shut-down device's boot failure carry the driver's message? → yes, bootShutdown passes it to BootTimeoutError (pending the maintainer)
Activity
V3RON commentedon Nov 3, 2026
Automated triage. I read the code only. I wrote no failing test and pushed no
bug/1199-reprobranch, because this routine changes no code. A maintainer or thetriage-bugflow still needs to add that test.Classification: Android bug, a regression in 0.5.0. Labelled
platform:android. It staysbug:new. Moving it tobug:readyis a maintainer call.Root cause. This is a defect with two parts:
src/drivers/android/index.ts:2282always passes-crash-report-mode neverto the emulator. That flag came in with 20c3640 (fix(android): start the emulator with -crash-report-mode never #1186), the fix for Android: a stale emulator crash dump makes every boot wait on a crash-report dialog until the lease times out #1183, and shipped in 0.5.0. Simlock never checks whether the installed emulator supports the flag. Per the report, Emulator 36.1.9 rejects it, so the emulator exits at once.src/drivers/android/index.ts:2020(#emulatorVersion) already readsemulator -version, but nothing uses the result to gate the flag.stdio: "ignore", and#waitForReadiness(src/drivers/android/index.ts:2126) only pollsadb getpropuntilBootTimeoutError. It never notices that the process has already exited, and it has no stderr to report.simlock doctorhas no check for the emulator version either.Simplest fix (proposal). Pass
-crash-report-modeonly when the emulator supports it: a version check, or a one-timeemulator -helpprobe. Also, fail the boot as soon as the spawned emulator exits, with an error that quotes its stderr tail. Deciding on a minimum supported emulator version (a doctor finding) is left to the maintainer.Risk
Duplicates / related: no duplicate found. Related: #1183 (closed, the bug whose fix introduced this flag) and #1186 (that fix).
Missing info: none needed. It would still help to know the oldest emulator version that accepts
-crash-report-mode. The report shows only that 36.1.9 rejects it and 37.2.13 accepts it.Written by an agent.
V3RON commentedon Nov 3, 2026
Reproduction
Confirmed. Gap: the boot wait never watches the emulator process, so an exit at launch costs 180 s and no reason. The expectation is a proposal.
src/drivers/android/index.test.ts:769, "fails the boot as soon as the emulator exits, naming the emulator's own error line", onbug/1199-repro(d90473c). The fake emulator prints the issue's 36.1.9 lines and exits 1; the clock never moves.Root cause
src/drivers/android/index.ts:2282passes-crash-report-mode never(#1186) to every emulator; 36.1.9 rejects it. The wait is the gap:#startEmulator(:2270) spawns withstdio: "ignore", and#waitForReadiness(:2126) polls only adb until the timeout, neverhandle.wait(). Thensrc/core/device-provisioner.ts:142replaces any driver reason with "Timed out waiting for device to boot" (#1229).Simplest fix
Ranked:
stdio: { file: <root>/<avd>.avd/emulator.log }(0600, truncated each start), racehandle.wait()in the boot wait, and on exit throwDriverCrashError("The emulator exited with code <n> before booting: <last lines>"). Covers every launch failure. Needs A lease whose new device fails to boot always says "Timed out waiting for device to boot" with code INTERNAL, whatever the driver's reason #1229, or the requester still reads "Timed out".androidPrerequisites): runemulator -help, report each fixed flag it lacks, remedysdkmanager --install emulator.requirements.mdx: name an emulator that accepts the flag (36.5.11 does).Alternatives rejected
-helplists it: brings back Android: a stale emulator crash dump makes every boot wait on a crash-report dialog until the lease times out #1183's dialog hang; the user's fix is onesdkmanagercommand.stdio: "ignore": still no reason.Risk
Side findings
Written by an agent.
V3RON commentedon Nov 3, 2026
Maintainer decision (relayed by an agent): fix as the triage report recommends — items 1 (fail fast on emulator exit with its own log lines), 2 (doctor check from
emulator -helpfor every flag Simlock always passes) and 3 (emulator requirement inrequirements.mdx). No flag-only-when-supported fallback, no pinned minimum version.Scope also includes #1229's fix, since item 1 is invisible without it:
DeviceProvisionerkeepsBootTimeoutError(reasonboot-timeout) but carries the driver's message instead of replacing it.Land before #1205, which rewrites the Android boot.
Written by an agent.
V3RON commentedon Nov 3, 2026
Fix spec (maintainer decision, relayed by an agent)
This supersedes the earlier automated triage's "pass the flag only when supported" proposal.
Tests
src/drivers/android/index.test.ts: fails the boot as soon as the emulator exits, naming the emulator's own error line (triage test onbug/1199-repro, d90473c): no wait for the boot timeout; the error is aDriverCrashErrorcarrying the last lines of the emulator's log.src/drivers/android/index.test.ts: the emulator's output goes to<avd folder>/emulator.log, mode 0600, truncated at each start; adopting a running emulator after a daemon restart and the taken-console-port cases behave as today.src/core/device-provisioner.test.ts: a new device whose driver fails to make it ready gives the requesterBootTimeoutError(reasonboot-timeout) carrying the driver's message (A lease whose new device fails to boot always says "Timed out waiting for device to boot" with code INTERNAL, whatever the driver's reason #1229; extend "rolls back a registered device…").emulator -helplacking a flag Simlock always passes (e.g.-crash-report-mode) gives a doctor finding naming the flag and the fixsdkmanager --install emulator; an emulator listing every flag gives none.Done when
unknown option: -crash-report-mode).simlock doctorreports an installed emulator that does not accept a flag Simlock always passes, withsdkmanager --install emulatoras the fix.Written by an agent.
fix(android): doctor reports an emulator lacking a flag Simlock alway…
test: the doctor reads the emulator's usage from stderr and bounds th…
V3RON commentedon Nov 3, 2026
Decision
Question: when an existing shut-down device fails to boot (
bootShutdown,src/leasing/lease-acquisition-coordinator.ts:1197), does the requester get the driver's message too? The fix spec's Tests name only the new-device path (device-provisioner).Taken: yes. That path rejects
BootTimeoutError(reasonboot-timeout) carrying the driver's message, as the provisioner path does. Done when line 2 ("a boot failure the driver reports with a reason reaches the requester with that reason") covers every boot, and without it a second lease of the same Pixel 9 would still time out with no reason.Tests:
src/leasing/coordinator test: a shut-down device whose driver fails to boot gives the requesterBootTimeoutError(reasonboot-timeout) carrying the driver's message.(decided in delivery, pending the maintainer)
Written by an agent.
fix(leasing): a shut-down device that fails to boot gives the request…
docs(android): drop the prerequisites doc comment whose process claim…
fix(android): keep the Android manual in budget, give the log folder …
V3RON commentedon Nov 3, 2026
Delivery run
Merged: #1232 (#1199)
Parked: none
Waiting: none
Decided: #1199 — does a shut-down device's boot failure carry the driver's message? → yes,
bootShutdownpasses it toBootTimeoutError(pending the maintainer)Written by an agent.
fix(android): fail the boot when the emulator exits, quoting its error (
test(drivers): one contract suite holds both fake drivers to the real…