App Crashes on simulator on booting

First of all thanks to this community for being a help so far.

I am using Appium 1.4.16 command line and trying to run my app on simulators. I get this error after the app tries to boot multiple times and crashes

The simulator opens up and shows the app luanching for few seconds and then crashes after multiple tries

A new session could not be created. (Original error: Instruments crashed on startup)",“origValue”:“Instruments crashed on startup”},“sessionId”:null}

The xcode version I use is xcpde 7.2 . Here is the full list to the log file

POST /wd/hub/session {“desiredCapabilities”:{“platformName”:“iOS”,“platformVersion”:9.2,“deviceName”:“iPhone 6”,“app”:"/Users/lakshmy/Library/Developer/Xcode/DerivedData/aPPNAMEBuild/Products/Debug-iphoneos/APPNAME.app",“name”:“aPPNAME”}}
info: Client User-Agent string: appium/ruby_lib/8.0.2
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : name
info: [debug] Using local app from desired caps: /Users/mYUSER//Library/Developer/Xcode/DerivedData/CSOP-bvfzkgutdegvqahcswuuclfsruvs/Build/Products/Debug-iphoneos/ssp.app
info: [debug] Creating new appium session 0c87ef98-61b0-41d1-a1ab-4cc3e2df4b23
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode version
info: [debug] Xcode version set to 7.2
info: [debug] Setting iOS SDK Version
info: [debug] iOS SDK Version set to 9.2
info: [debug] Checking whether instruments supports our device string
info: [debug] Getting list of devices instruments supports
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“7.2”,“iOSSDKVersion”:“9.2”,“deviceName”:“iPhone 6”,“platformVersion”:9.2}
info: [debug] fixDevice is on
info: [debug] Fixing device. Changed from: “iPhone 6 (9.2)” to: “iPhone 6 (9.2) [”
info: [debug] Final device string is: ‘iPhone 6 (9.2) [’
info: [debug] iOS sim UDID is 6279E70C-C732-48FA-85DF-8F87B25C3999
info: [debug] Auto-detecting iOS udid…
info: [debug] Not auto-detecting udid, running on sim
info: [debug] Could not parse plist file (as binary) at /Users/mYUSER//Library/Developer/Xcode/DerivedData/CSOP-bvfzkgutdegvqahcswuuclfsruvs/Build/Products/Debug-iphoneos/ssp.app/en.lproj/Localizable.strings
info: Will try to parse the plist file as XML
info: [debug] Could not parse plist file (as XML) at /Users/mYUSER//Library/Developer/Xcode/DerivedData/CSOP-bvfzkgutdegvqahcswuuclfsruvs/Build/Products/Debug-iphoneos/ssp.app/en.lproj/Localizable.strings
warn: Could not parse app Localizable.strings assuming it doesn’t exist
info: [debug] Getting bundle ID from app
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Creating instruments
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/mYUSER//Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {“nodePath”:"/usr/local/Cellar/node/5.7.0/bin/node",“commandProxyClientPath”:"/usr/local/lib/node_modules/appium/node_modules/appium-uiauto/bin/command-proxy-client.js",“instrumentsSock”:"/tmp/instruments_sock",“interKeyDelay”:null,“justLoopInfinitely”:false,“autoAcceptAlerts”:false,“autoDismissAlerts”:false,“sendKeyStrategy”:“oneByOne”}
info: [debug] Dynamic bootstrap code: // This file is automatically generated. D…ot manually modify!
info: [debug] Dynamic bootstrap path: /Users/mYUSER//Library/Application Support/appium/bootstrap/bootstrap-f7b421311df960f2.js
info: [debug] Reusing dynamic bootstrap: /Users/mYUSER/Library/Application Support/appium/bootstrap/bootstrap-f7b421311df960f2.js
info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“7.2”,“iOSSDKVersion”:“9.2”,“deviceName”:“iPhone 6”,“platformVersion”:9.2}
info: [debug] fixDevice is on
info: [debug] Fixing device. Changed from: “iPhone 6 (9.2)” to: “iPhone 6 (9.2) [”
info: [debug] Final device string is: ‘iPhone 6 (9.2) [’
info: [debug] We’re on iOS7.1+ so forcing defaultDevice on
info: [debug] Getting device string from opts: {“forceIphone”:false,“forceIpad”:false,“xcodeVersion”:“7.2”,“iOSSDKVersion”:“9.2”,“deviceName”:“iPhone 6”,“platformVersion”:9.2}
info: [debug] fixDevice is on
info: [debug] Fixing device. Changed from: “iPhone 6 (9.2)” to: “iPhone 6 (9.2) [”
info: [debug] Final device string is: ‘iPhone 6 (9.2) [’
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Wrote new app Info.plist with device type
info: [debug] Checking whether we need to set app preferences
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killing any other simulator daemons
info: [debug] Killall Simulator
info: [debug] Cleaning sim data files
info: node-simctl: Executing: xcrun with args: simctl erase 6279E70C-C732-48FA-85DF-8F87B25C3999 and timeout: 2000
info: [debug] Cleaning app data files
warn: Applications directory /Users/lmYUSER/Library/Developer/CoreSimulator/Devices/6279E70C-C732-48FA-85DF-8F87B25C3999/data/Containers/Data/Application doesn’t exist. Have you run this simulator before?
warn: Applications directory /Users/Myuser/Library/Developer/CoreSimulator/Devices/6279E70C-C732-48FA-85DF-8F87B25C3999/data/Containers/Bundle/Application doesn’t exist. Have you run this simulator before?
info: Couldn’t find app directories to delete. Probably it’s not installed
info: [debug] Not setting locale
info: [debug] No iOS / app preferences to set
info: [debug] Starting iOS 8.* simulator log capture
info: [debug] Not pre-launching simulator
info: [debug] Starting command proxy.
info: [debug] Instruments socket server started at /tmp/instruments_sock
info: [debug] Starting instruments
info: [debug] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
info: Launching instruments
info: [debug] Attempting to run app on iPhone 6 (9.2) [
info: On xcode 7.0, instruments-without-delay does not work, skippinginstruments-without-delay
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w “iPhone 6 (9.2) [” /Users/lakshmy/Library/Developer/Xcode/DerivedData/Appbuild/Build/Products/Debug-iphoneos/ssp.app -e UIASCRIPT “/Users/lakshmy/Library/Application Support/appium/bootstrap/bootstrap-f7b421311df960f2.js” -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And launch timeouts (in ms): {“global”:90000}
info: [debug] [INST] Waiting for device to boot…
info: [debug] [INST STDERR] 2016-02-29 11:28:32.062 instruments[44403:1626912] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] 2016-02-29 11:28:32.063 instruments[44403:1626941] Attempting to change event horizon while disengage
Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.) : Failed to launch process with bundle identifier ‘com.packagename.appname’
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #1
info: [debug] Killall Simulator
info: Launching instruments
info: [debug] Attempting to run app on iPhone 6 (9.2) [
info: On xcode 7.0, instruments-without-delay does not work, skippinginstruments-without-delay
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w “iPhone 6 (9.2) [” /Users/lakshmy/Library/Developer/Xcode/DerivedData/Appbuild/Build/Products/Debug-iphoneos/appname.app -e UIASCRIPT “/Users/lakshmy/Library/Application Support/appium/bootstrap/bootstrap-f7b421311df960f2.js” -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And launch timeouts (in ms): {“global”:90000}
info: [debug] [INST] Waiting for device to boot…
info: [debug] [INST STDERR] 2016-02-29 11:28:49.459 instruments[44509:1628806] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.) : Failed to launch process with bundle identifier ‘com.packagename.appname’
info: [debug] [INST STDERR] 2016-02-29 11:28:49.463 instruments[44509:1628806] Attempting to change event horizon while disengage
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #2
info: [debug] Killall Simulator
info: Launching instruments
info: [debug] Attempting to run app on iPhone 6 (9.2) [
info: On xcode 7.0, instruments-without-delay does not work, skippinginstruments-without-delay
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w “iPhone 6 (9.2) [” /Users/lakshmy/Library/Developer/Xcode/DerivedData/“BuildnAM”/Build/Products/Debug-iphoneos/APPNAME-e UIASCRIPT “/Users/Myuser/Library/Application Support/appium/bootstrap/bootstrap-f7b421311df960f2.js” -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And launch timeouts (in ms): {“global”:90000}
info: [debug] [INST] Waiting for device to boot…
info: [debug] [INST STDERR] 2016-02-29 11:29:06.295 instruments[44604:1630180] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] 2016-02-29 11:29:06.297 instruments[44604:1630175] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.) : Failed to launch process with bundle identifier ‘com.loyal3.SSP’
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] Attempting to retry launching instruments, this is retry #3
info: [debug] Killall Simulator
info: Launching instruments
info: [debug] Attempting to run app on iPhone 6 (9.2) [
info: On xcode 7.0, instruments-without-delay does not work, skippinginstruments-without-delay
info: [debug] Spawning instruments with command: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w “iPhone 6 (9.2) [” /Users/Myuser/Library/Developer/Xcode/DerivedData/CSOP-bvfzkgutdegvqahcswuuclfsruvs/Build/Products/Debug-iphoneos/ssp.app -e UIASCRIPT “/Users/lakshmy/Library/Application Support/appium/bootstrap/bootstrap-f7b421311df960f2.js” -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And launch timeouts (in ms): {“global”:90000}
info: [debug] [INST] Waiting for device to boot…
info: [debug] [INST STDERR] 2016-02-29 11:29:23.045 instruments[44692:1631342] Attempting to change event horizon while disengage
info: [debug] [INST STDERR] Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.) : Failed to launch process with bundle identifier ‘com.loyal3.SSP’
info: [debug] [INST STDERR] 2016-02-29 11:29:23.057 instruments[44692:1631398] Attempting to change event horizon while disengage
info: [debug] [INSTSERVER] Instruments exited with code 253
info: [debug] Killall instruments
info: [debug] Instruments crashed on startup
info: [debug] We exceeded the number of retries allowed for instruments to successfully start; failing launch
info: [debug] Stopping iOS log capture
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killing any other simulator daemons
info: [debug] Killall Simulator
info: [debug] Cleaning sim data files
info: node-simctl: Executing: xcrun with args: simctl erase 6279E70C-C732-48FA-85DF-8F87B25C3999 and timeout: 2000
info: [debug] Cleaning app data files
warn: Applications directory /Users/Myuser/Library/Developer/CoreSimulator/Devices/6279E70C-C732-48FA-85DF-8F87B25C3999/data/Containers/Data/Application doesn’t exist. Have you run this simulator before?
warn: Applications directory /Users/Myuser/Library/Developer/CoreSimulator/Devices/6279E70C-C732-48FA-85DF-8F87B25C3999/data/Containers/Bundle/Application doesn’t exist. Have you run this simulator before?
info: Couldn’t find app directories to delete. Probably it’s not installed
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Instruments crashed on startup
info: [debug] Error: Instruments crashed on startup
at [object Object].Instruments.onInstrumentsExit (/usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:448:31)
at [object Object]. (/usr/local/lib/node_modules/appium/node_modules/appium-instruments/lib/instruments.js:355:12)
at emitTwo (events.js:100:13)
at ChildProcess.emit (events.js:185:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Instruments crashed on startup)”,“origValue”:“Instruments crashed on startup”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 82256.744 ms - 182

Can someone help?

First, can you open the Simulator manually with Xcode? Is everything working?

The above is the command Appium is using to start the Simulator. Can copy and paste this into a terminal window & run it?

Also, you should open this file & see what it says (it’s the instruments trace log):

I’ve seen problems like this on an upgrade of Xcode. If nothing above helps, you might just try deleting Xcode and reinstalling from the App Store.

Thanks again . When I run /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /tmp/appium-instruments/instrumentscli0.trace -w “iPhone 6 (9.2) [” /Users/lakshmy/Library/Developer/Xcode/DerivedData/Appbuild/Build/Products/Debug-iphoneos/ssp.app -e UIASCRIPT “/Users/lakshmy/Library/Application Support/appium/bootstrap/bootstrap-f7b421311df960f2.js” -e UIARESULTSPATH /tmp/appium-instruments

I get the following error on instruments trace log

Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 1.) : Failed to launch process with bundle identifier

FYI :If I build and run from xcode it works fine on simulatore

I did a quick google search on the error and came up with this, which looks promising:

Can you read through & see if anything there helps?

Hi,
Any luck with this?
I am also facing the same issue and not finding a suitable solution.
Did anyone find a solution to this one?

Thanks,
Nishant Shah

HI, any solution over this?