[Bug]: Device screenshot fails with 500 on iPhone Duo (Xcode 27.2): serve-sim calls simctl without --display #24900
Before submitting#
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area#
apps/server
Steps to reproduce#
- With Xcode 27.2, boot an iPhone Duo simulator (iOS 27.2 runtime
iOS-27-2-iPhone19-4). Folded or unfolded doesn't matter. - Open it in the T3 Code Device panel.
- Click the camera (screenshot) button in the device toolbar.
Expected behavior#
You get a PNG of the panel currently showing: the cover display (1398×2034) when folded, or the inner display (2007×2853) when unfolded.
Actual behavior#
The panel shows "Screenshot capture failed (500). Try again." It fails every time.
The proxy forwards POST /api/device-hub/vendor/serve-sim/api/screenshot?device=<udid> to the vendored serve-sim. serve-sim returns 500 because xcrun simctl io <udid> screenshot <file> exits with code 22:
Cannot choose between 2 displays. Specify one with --display:
--display=3 LCD-1 (primary-1) 2007x2853
--display=1 LCD (primary) 1398x2034
Invalid argument
Cause: The pinned expo-device-hub@0.15.3 (apps/server/src/device/deviceToolVersions.json) runs the simctl screenshot without --display. In its vendored serve-sim/dist/middleware.js, the /api/screenshot route calls:
B6("xcrun", ["simctl", "io", y, "screenshot", b], { timeout: 5000 }, ...)
This matches expo/expo-device-hub#441. On Xcode 27.1, simctl defaulted to the inner panel, so a folded Duo gave an all-black image. On Xcode 27.2, simctl refuses to pick a display on two-display devices, so the capture fails outright.
Suggested fix#
Upstream fixed this in expo/expo-device-hub#384 and #388 (merged 2026-10-23, 706806e). /api/screenshot and screenshot.capture now pass --display=<active panel>. I checked the published tarballs:
expo-device-hub@0.18.0(currentlatest): still callssimctl io … screenshotwithout--display.expo-device-hub@0.19.0-canary-20261023-1357114: includes the fix:["simctl","io",$.udid,"screenshot",...(_===void 0?[]:[`--display=${_}`]),$.file]
Suggested change: bump expo-device-hub in apps/server/src/device/deviceToolVersions.json to the first stable release that includes expo#384/#388 (presumably 0.19.0) once it's published. Nothing in T3 needs to change for single-display devices, since upstream only adds --display when a panel is selected.
What I could not check: I haven't run T3 against the canary. I confirmed the fix by reading the canary bundle and by running simctl by hand (see Workaround).
Related, but a separate problem: #24033, where device_screenshot drops the failure reason. Here the UI only showed "500". The simctl message above came from calling the hub directly.
Impact#
Major degradation or frequent failure
Version or commit#
T3 Code Nightly 0.1.3-nightly.20261025.3669 (Electron 44.9.3, Chrome 152.0.7977.167); expo-device-hub 0.15.3 (pinned), agent-device 0.21.25
Environment#
macOS 27.0 (26A428), Xcode 27.2 (27B48), simulator iPhone Duo (com.apple.CoreSimulator.SimDeviceType.iPhone-Duo) on runtime iOS 27.2 (24B91014, com.apple.CoreSimulator.SimRuntime.iOS-27-2-iPhone19-4)
Logs or stack traces#
# server.trace.ndjson (wsTicket redacted)
POST http://127.0.0.1:3773/api/device-hub/vendor/serve-sim/api/screenshot?device=6D680333-…&hostId=local -> 500
HttpClientError: StatusCode error (500 POST http://127.0.0.1:<hub>/vendor/serve-sim/api/screenshot?device=6D680333-…)
# Direct call to the hub
$ curl -s -X POST "http://127.0.0.1:<hub>/vendor/serve-sim/api/screenshot?device=<udid>"
{"ok":false,"error":"Detected file type from extension: PNG\nAn error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):\nCannot choose between 2 displays. Specify one with --display:\n --display=3 LCD-1 (primary-1) 2007x2853\n --display=1 LCD (primary) 1398x2034\nInvalid argument"}
Workaround#
Capture from the terminal and name the display:
xcrun simctl io <udid> screenshot --display=1 folded.png # cover
xcrun simctl io <udid> screenshot --display=3 unfolded.png # inner
Both commands succeed on the same device. Single-display simulators aren't affected.
Thanks for the detailed report and the upstream pointers. This is fixed on
mainby 10629afa (pingdotgg/t3code#24912, merged 2026-10-26). It pinsexpo-device-hubto0.19.0-canary-20261023-1357114inapps/server/src/device/deviceToolVersions.json. Your nightly (0.1.3-nightly.20261025.3669, hub 0.15.3) was built before that.What I checked on
main(689763a6):- The server installs and runs the hub version pinned in that file (
DEVICE_HUB_VERSIONinDeviceToolchain.ts). - In that canary's
vendor/serve-sim/dist/middleware.js,/api/screenshotaccepts an optional?display=. Without it, the hub looks up the simulator's active screen and runsxcrun simctl io <udid> screenshot --display=<id> <file>, with a retry if the fold changes mid-capture. T3's proxy sends only?device=, so the hub selects the panel on its own, as you expected.
I could not run this against a real iPhone Duo on Xcode 27.2. If the next nightly still returns 500 from the screenshot button, please reopen and include the hub's response body.
- The server installs and runs the hub version pinned in that file (
juliusmarminge closed this
Sign in to join this conversation.
Image for reference: