{"record":{"id":"64783d09cf004308","repo":"stablyai/orca","slug":"emulator-device-not-found-64783d","errorCode":"emulator_device_not_found","errorMessage":"Simulator ${udid} not found. Create one via Xcode > Window > Devices and Simulators.","messagePattern":"Simulator (.+?) not found\\. Create one via Xcode > Window > Devices and Simulators\\.","errorType":"error_code","errorClass":"EmulatorError","httpStatus":null,"severity":"error","filePath":"src/main/emulator/simctl-simulator-devices.ts","lineNumber":134,"sourceCode":"      if (typeof device === 'string' && device.toLowerCase().includes(deviceOrName.toLowerCase())) {\n        return device\n      }\n    }\n  } catch {}\n  return deviceOrName\n}\n\nexport async function ensureSimulatorBooted(udid: string): Promise<void> {\n  if (platform() !== 'darwin') {\n    throw new EmulatorError(\n      'emulator_not_macos',\n      'iOS Simulator requires macOS with Xcode Command Line Tools.'\n    )\n  }\n  const devices = await listSimulatorDevices()\n  const device = devices.find((candidate) => candidate.udid === udid)\n  if (!device) {\n    throw new EmulatorError(\n      'emulator_device_not_found',\n      `Simulator ${udid} not found. Create one via Xcode > Window > Devices and Simulators.`\n    )\n  }\n  if (device.state === 'Booted') {\n    return\n  }\n\n  try {\n    await new Promise<void>((resolve, reject) => {\n      execFile('xcrun', ['simctl', 'boot', udid], { timeout: 45_000 }, (error, _stdout, stderr) => {\n        if (error) {\n          const message = error.message.toLowerCase()\n          if (message.includes('booted') || message.includes('current state')) {\n            resolve()\n            return\n          }\n          reject(mapSimctlError(error, stderr))","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/emulator/simctl-simulator-devices.ts#L116-L152","documentation":"ensureSimulatorBooted lists devices via simctl and the requested udid is not among them. The simulator must already exist before it can be booted; Orca does not create devices implicitly.","triggerScenarios":"listSimulatorDevices().find(candidate => candidate.udid === udid) returns undefined (simctl-simulator-devices.ts:131-137).","commonSituations":"udid typo; the device was erased/deleted; a fresh Xcode install with no simulators; the wrong Xcode is active (xcode-select).","solutions":["Create the simulator in Xcode > Window > Devices and Simulators, or `xcrun simctl create <name> <type>`.","Copy the udid exactly from `xcrun simctl list devices`.","Run `xcode-select -p` to confirm the expected Xcode is active."],"exampleFix":"// before\nawait ensureSimulatorBooted('BOGUS-UDID')\n\n// after\nconst devices = await listSimulatorDevices()\nif (!devices.some((d) => d.udid === udid)) {\n  throw new Error(`Create ${udid} first: xcrun simctl create ...`)\n}\nawait ensureSimulatorBooted(udid)","handlingStrategy":"validation","validationCode":"const devices = await listSimulatorDevices()\nif (!devices.some((d) => d.udid === udid)) { /* create device or fix udid */ }","typeGuard":"function isEmulatorError(e: unknown, code = 'emulator_device_not_found'): e is import('./emulator-errors').EmulatorError {\n  return e instanceof Error && (e as any).code === code && e.name === 'EmulatorError'\n}","tryCatchPattern":"try { await ensureSimulatorBooted(udid) }\ncatch (e) { if (isEmulatorError(e, 'emulator_device_not_found')) { udid = await pickOrCreateSimulator() } else throw e }","preventionTips":["Copy udids from `xcrun simctl list devices`.","Create devices via Xcode or `xcrun simctl create` before scripting.","Confirm the active Xcode with `xcode-select -p`."],"tags":["ios","simulator","device-not-found"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}