run-ios: "Unable to boot device in current state: Booted" alert when the simulator is already booted
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- react-native, typescript
- Domain
- cli, mobile-dev
Research direction
Start in packages/cli-platform-apple/src/commands/runCommand/runOnSimulator.ts and reproduce npx react-native run-ios with a simulator that is already booted. Check the Simulator.app launch path and the existing boot-state guard; done means repeated launches foreground the running simulator without showing the boot alert.
Written by the indexing model from the issue text.
Description
Environment
@react-native-community/cli:20.2.0(also reproduces onmain, latest commit9013a48at time of writing)- OS: macOS (Apple Silicon)
- Xcode: stable (not Xcode 27 beta) —
Simulator.apppresent at$(xcode-select -p)/Applications/Simulator.app, so therun-ioscode path takes theSimulator.appbranch (not the DeviceHub branch added in #2806)
Description
Running run-ios against a simulator that is already booted pops a modal alert from Simulator.app reading:
Unable to boot device in current state: Booted
before the build proceeds. The alert must be dismissed manually and it recurs on every re-launch until the simulator is shut down. The build itself still succeeds. A cold first launch (no booted device) is unaffected.
Root cause
In packages/cli-platform-apple/src/commands/runCommand/runOnSimulator.ts, the open Simulator.app --args -CurrentDeviceUDID <udid> call runs unconditionally, before the simulator.state !== 'Booted' guard:
if (fs.existsSync(simulatorApp)) {
child_process.execFileSync('open', [
simulatorApp,
'--args',
'-CurrentDeviceUDID',
simulator.udid,
]);
} else if (fs.existsSync(deviceHubApp)) {
...
}
if (simulator.state !== 'Booted') {
bootSimulator(simulator);
}
Passing -CurrentDeviceUDID for an already-booted device makes Simulator.app re-attempt a boot of that device, which CoreSimulator rejects with the exact string Unable to boot device in current state: Booted. Simulator.app surfaces that rejection as a modal alert.
The later simulator.state !== 'Booted' guard correctly skips the explicit xcrun simctl boot, but it is too late — the open ... --args -CurrentDeviceUDID call has already provoked the dialog. The DeviceHub branch (Xcode 27+) is unaffected, since it never passes -CurrentDeviceUDID.
Fix
Only pass -CurrentDeviceUDID when the device is not already booted; when it is booted, just bring the running Simulator.app to the foreground. A PR is incoming.
Reproducible Demo
npx react-native run-ios— boots a fresh simulator; no alert.- Leave the simulator booted (don't shut it down).
npx react-native run-iosagain → the "Unable to boot device in current state: Booted" modal appears over Simulator.app.- Click OK to dismiss; the build continues normally.
- Reproduces on every subsequent
run-iosuntil the simulator is shut down.
Expected: Step 3 should just foreground Simulator.app and install/launch the app — no alert — same as the clean first launch.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 949
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from react-native-community/cli
-
bug report
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
react-native-community/cli#2826 ·
-
bug report
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
react-native-community/cli#2825 ·
-
feature request
Difficulty 4/5 3-5 days Newbie friendliness 68/100
react-native-community/cli#2856 ·
-
FASOCARD Openbug report
Difficulty 5/5 Over a week Newbie friendliness 5/100
react-native-community/cli#2855 ·
-
FASOCARD Openbug report
Difficulty 5/5 Over a week Newbie friendliness 10/100
react-native-community/cli#2854 ·
All issues in react-native-community/cli
Similar issues
-
S: triage
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
fix(errors): EHOSTUNREACH from a happy-eyeballs connect is reported as a resolver error (STAMP-80) Open
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
snapshot-labs/stamp#666 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
GauravKarakoti/SecureFlow#1070 · 1 comment ·
-
feature:Languages/Translations good first issue ready Web
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
digitalfabrik/integreat-app#4394 ·