Xcode exit code 65

Please contact support about this and we’ll credit you for minutes used on these exit 65 failures. We’re still investigating the cause of these flakey failures, but we don’t want you paying extra for them.

Hey all,

I understand this must be terribly frustrating. We have people spending time trying to diagnose this (and have been looking at this for awhile unfortunately). It appears that Error Code 65 is a more generic error code which makes this diagnosis harder as it likely pertains to several possibly unrelated topics.

In our research, we’ve found that it appears to hit many OS X platforms (including complements and competitors). Because it’s increasingly common, we have tried to diagnose if hosting has a common cause. It appears to have started happening more since the last version of XCode as well. We feel a similar frustration ourselves as we continue to try and solve this.

My team recently shipped a change such that

  1. you won’t be charged for the minutes spent where a build fails due to Error Code 65

  2. We will auto-retry that build for you up to 3x (as we’ve seen repeatedly this bug can be intermittent).

It doesn’t solve the issue (I wish we could do that as easily!) but I hope it shows a sign of respect for your situation. Thanks for being CircleCI customers.

5 Likes

Is there a way to determine how many minutes were credited back due to Error Code 65? I burned through a ton of builds trying to diagnose and fix this issue over the last month.

One thing I have learned that might shed some light, my issues seem related to the tee command that Fastlane scan emits as part of the build step.

Fastlane scan emits this:

set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace ./the_workspace.xcworkspace -scheme 'the_scheme' -configuration 'Test' -destination 'platform=iOS Simulator,OS=9.3,name=iPhone 5s' -enableCodeCoverage YES build test | tee '/Users/distiller/Library/Logs/scan/App-log.log' | xcpretty

If I execute this command directly as part of my circle.yml file it will still fail as described in this thread but both Fastlane and this command run fine on my team’s local machines.

Dropping the tee command allows it to succeed reliably on Circle.

Here is the command I’m currently using in my circle.yml file:

test:
  override:
    - set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace './the_workspace.xcworkspace' -scheme 'the_scheme' -configuration 'Test' -destination 'platform=iOS Simulator,OS=9.3,name=iPhone 5s' -enableCodeCoverage YES build test | xcpretty

Is there any followup for this issue? I’m continuing to get seemingly random build/test failures with error code 65 and it’s very frustrating to have to keep rebuilding until it works.

1 Like

Nothing definite yet but our mobile team has isolated some really promising root causes and we’re testing possible solutions with 1-2 alpha customers now. As soon as we have it solved, we will update.

Thanks for your understanding! Xcode is tricky…

EDIT Jan 16 2017: We no longer recommend using UUIDs to start simulators. The OS X image has been updated to resolve the underlying issue, and using UUIDs is no longer necessary. Please check out this post for examples of how to choose the simulators by name.

Hey everyone,

this issue is for most people very likely caused by a timeout because the iOS simulator not starting fast enough.

A workaround that has been tested by us is starting the GUI simulator first with:

- xcrun instruments -w 'Select a iOS Simulator UUID' || true
- sleep 15

This is a list of possible iOS Simulator UUIDs you can use:

iPad 2 (8.4) [A4276BA9-2D38-434D-A063-A1A7DC399235] (Simulator)
iPad 2 (9.0) [2F39BEF2-E92D-498C-B2D9-29366BD8F732] (Simulator)
iPad 2 (9.3) [101B434D-924B-4C7E-B8C1-ED8B376BF7CA] (Simulator)
iPad Air (8.4) [AD005E41-F7E6-4C5F-B3B1-6C980E834739] (Simulator)
iPad Air (9.0) [42D87249-99F2-4BC1-9180-317D268C46F7] (Simulator)
iPad Air (9.3) [72F9B9E8-DC05-4450-B030-407D4B0968D9] (Simulator)
iPad Air 2 (9.0) [6E2B1E19-6466-4328-917C-16019130FDE8] (Simulator)
iPad Air 2 (9.3) [A141F49D-F20A-49B3-ACBF-A97F9FFB9B89] (Simulator)
iPad Retina (8.4) [399AEF36-5560-4C4A-AE61-03F0A81555D0] (Simulator)
iPad Retina (9.0) [A1EC86BA-49AB-414B-9C27-2D0F26A34A81] (Simulator)
iPad Retina (9.3) [A70FE3C7-756F-44BF-BE46-68663FAE2EE3] (Simulator)
iPhone 4s (8.4) [F2E9EEAB-9FCE-4109-A40F-3DD79627C985] (Simulator)
iPhone 4s (9.0) [5EF3DECC-3E8F-41A0-B2CF-DC384A66E12E] (Simulator)
iPhone 4s (9.3) [8538CCCC-80FB-4B6B-9281-222771C38FEB] (Simulator)
iPhone 5 (8.4) [C5C8EA0E-F5A8-4AF8-BBAA-385B61026A5E] (Simulator)
iPhone 5 (9.0) [24F6F5A0-343E-4C64-9F4C-B50D88F5E99E] (Simulator)
iPhone 5 (9.3) [075FB8BA-F088-4A16-89CF-4EA36BC25E7A] (Simulator)
iPhone 5s (8.4) [45BFA4E8-C0A9-4A04-9CD0-4449FE4CF40B] (Simulator)
iPhone 5s (9.0) [49DAC9E5-C129-497D-853E-D93BC4BB8A10] (Simulator)
iPhone 5s (9.3) [3011ED5C-C63A-42E6-9D91-82A39DE4AD06] (Simulator)
iPhone 6 (8.4) [65AAA024-64D5-40B9-A122-8872E3F52EC4] (Simulator)
iPhone 6 (9.0) [53600017-30F1-428A-A16A-25C6CEDBD849] (Simulator)
iPhone 6 (9.3) [547B1B63-3F66-4E5B-8001-F78F2F1CDEA7] (Simulator)
iPhone 6 Plus (8.4) [DFB14113-4697-4E2D-AD3F-B4FBA4B62969] (Simulator)
iPhone 6 Plus (9.0) [321D1CF5-2514-4897-8B09-C133602F6DB5] (Simulator)
iPhone 6 Plus (9.3) [C63728B8-89B5-4FFB-8B6E-174A2F85B47F] (Simulator)
iPhone 6s (9.0) [763DC427-F2C5-4AA4-989F-2CA944FA8F04] (Simulator)
iPhone 6s (9.3) [E8DD285C-51EE-4DB5-B326-7E927686EC36] (Simulator)
iPhone 6s Plus (9.0) [011805C3-BB7A-4785-A313-D7AD2AF6DE49] (Simulator)
iPhone 6s Plus (9.3) [019CFBB0-0086-44A7-AA41-D39182D9CE01] (Simulator)

If you still run into issues please feel free to send a support request so that I can take a look at your builds and gather more information this way.

Thanks for your patience, I really do hope that this will get rid of red builds for a lot of you!

I’ve submitted a radar to Apple. Feel free to dupe it so that we can get more attention to this issue :slight_smile:

Greetings,
Constantin

4 Likes

I implemented the fix you recommended @anon47539524 like this:
dependencies: pre: - xcrun instruments -w 'A70FE3C7-756F-44BF-BE46-68663FAE2EE3' || true - sleep 15

And I have still gotten a code 65 error, albeit only one so far.

Do you know, are some simulators faster to load than others?

1 Like

I get a template-missing error when I try that:

distiller-build-8:~ distiller$ xcrun instruments -w ‘A70FE3C7-756F-44BF-BE46-68663FAE2EE3’
2016-07-28 15:34:43.398 instruments[3140:14974] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk; its version (7.1) is below required minimum (9.3) for the iphonesimulator platform.
2016-07-28 15:34:43.399 instruments[3140:14974] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk; its version (8.4) is below required minimum (9.3) for the iphonesimulator platform.
2016-07-28 15:34:43.399 instruments[3140:14974] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk; its version (9.0) is below required minimum (9.3) for the iphonesimulator platform.
2016-07-28 15:34:43.400 instruments[3140:14974] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.1.sdk; its version (9.1) is below required minimum (9.3) for the iphonesimulator platform.
2016-07-28 15:34:43.400 instruments[3140:14974] [MT] DVTSDK: Skipped SDK /Applications/Xcode-7.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk; its version (9.2) is below required minimum (9.3) for the iphonesimulator platform.
Waiting for device to boot…
Instruments Usage Error: No template (-t) specified
instruments, version 7.3 (60134)

1 Like

I just double checked with @anon47539524 it looks like you are actually missing ||true, can you try to run the command like this:

xcrun instruments -w 'A70FE3C7-756F-44BF-BE46-68663FAE2EE3' || true

Hey Geoffrey,

this is indeed an issue with the a template, but simply because we don’t specify one to make it launch quicker. You don’t want to profile your application in any way, you’re simply using xcrun instruments because Instruments is able to launch the GUI iOS simulator reliably (which xcrun simctl isn’t). The Instruments command itself fails, but it launches the iOS simulator anyways. Please add || true at the very end of your command to suppress a non-0 exit code.

1 Like

Hey,

this might happen. I’ve seen this before, you might be a special case and this fix wont do the job on your project. I’d love to take a look. Please contact our Support and reference this text, so that I can find your ticket.

Constantin

The xcrun instruments trick seems mostly to work for us, with occasional failures that are fixed by retrying. Quite frustrating that there doesn’t seem to be a reliable solution.

EDIT: It looks like the inconsistency may have just been from invoking xcrun instruments with the wrong simulator UUID; builds have been fine since I fixed that.

Hello, I was also getting this Xcode exit code 65 issue. It was generated from UITests Scheme. For me UITests Scheme was not much important as I have only functional test coverage, so I deleted the UITests Scheme & able to run all test cases without any issue.
May this help for few people.

1 Like

isolated some really promising root causes and we’re testing

I assume this didn’t get anywhere?

Is this still present on Xcode 8 builds as well?

@anon47539524’s post covered what ended up being the majority of cases. If you’re still having issues, let us know! Exit Code 65 is a generic Apple error code so I fully expect that there are still many of them - just less now.

The issue reappeared in XCode 8 and the workaround is not working for us any longer:
When using the workaround as following:

pre:
    - xcrun instruments -w '2D96E690-BFB5-44D5-8B22-31D9C57EDADF' || true
    - sleep 15

I’m seeing the following error

Instruments Usage Error: No template (-t) specified
instruments, version 8.0 

Any ideas?

1 Like

Hey Ben,

Could you please open a support ticket and provide this link as a reference so that it’ll end up with me. Please also link to the failed builds.

Best,
Constantin

I am having the same issue as Ben with Xcode 8. The fix no longer works. I would greatly appreciate if you could keep this thread up to date rather than having to communicate on an individual basis as I’m sure others are having the same issue.

Thanks!

For those wondering, here are the simulator UUIDs for iOS 10 that are available in the build container. I got these by SSH-ing into one of my builds and invoking xcrun simctl list with DEVELOPER_DIR set to the Xcode 8 directory. I’ve only tried the iPhone 6 one but it seems to be working correctly.

-- iOS 10.0 --
    iPhone 5 (85D8FE66-1208-4478-811C-7BD1AA3B33CA) (Shutdown)
    iPhone 5s (1FB033A8-440D-45F3-B95D-03E4E38B51DF) (Shutdown)
    iPhone 6 (33D34EBA-703E-4A82-8838-BE75171492E1) (Shutdown)
    iPhone 6 Plus (5525775C-A351-4986-9BF4-144A84E253AA) (Shutdown)
    iPhone 6s (F08BA729-6AD2-42DF-A210-34DC8D990011) (Shutdown)
    iPhone 6s Plus (A310FC97-435A-4026-AF85-F1216F856BA5) (Shutdown)
    iPhone 7 (2D96E690-BFB5-44D5-8B22-31D9C57EDADF) (Shutdown)
    iPhone 7 Plus (D4155E82-B930-450B-AFC7-F4800669EC65) (Shutdown)
    iPhone SE (84A11478-B7D4-4968-A626-E27CE7372148) (Shutdown)
    iPad Retina (D56EBD40-B853-4D56-B482-D4C40E69A3FC) (Shutdown)
    iPad Air (B9257F59-88B3-421D-B1F2-2BD92F0858D0) (Shutdown)
    iPad Air 2 (AC291080-8EFE-4095-8C55-B1E952EFFC36) (Shutdown)
    iPad Pro (9.7 inch) (F9C94E2A-F080-4AB0-93D6-A41135919D8E) (Shutdown)
    iPad Pro (12.9 inch) (BF8D8AD2-6A96-4A62-8059-A836738BB873) (Shutdown)

Hey,

I’ve created a new thread in order to keep better track of this here: Xcode Exit Code 65 + UI Tests

I’m working on it nonstop but I haven’t yet found a solution.