Skip to content
Latchkey

fastlane pilot "upload to TestFlight failed" in CI

pilot (upload_to_testflight) uploads the built IPA to App Store Connect for TestFlight. Uploads fail when the binary is invalid (missing entitlements, bad version), the API key lacks permission, or the bundle version already exists.

What this error means

fastlane pilot/upload_to_testflight fails with an App Store Connect error such as "The bundle version must be higher than the previously uploaded version" or "ERROR ITMS-90xxx".

fastlane
[!] The upload failed: The bundle version must be higher than the previously
uploaded version. (ERROR ITMS-4000)

Common causes

A build number that is not higher than the last upload

App Store Connect requires a strictly increasing build number per version; reusing or lowering it is rejected.

An invalid binary or insufficient API key permission

Missing entitlements, a bad Info.plist, or an API key without upload rights causes the processing or auth step to fail.

How to fix it

Bump the build number before upload

  1. Set a unique, increasing build number (for example the CI run number).
  2. Rebuild the IPA with that build number.
  3. Re-run upload_to_testflight.
Fastfile
increment_build_number(build_number: ENV["GITHUB_RUN_NUMBER"])
upload_to_testflight(api_key: api_key)

Read the ITMS error and fix the binary or key

ITMS-90xxx codes name the specific rejection (entitlements, icons, version). Address the named issue, and confirm the API key has upload permission.

How to prevent it

  • Derive the build number from the CI run so it always increases.
  • Validate the archive locally before uploading.
  • Use an App Store Connect API key with upload rights.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →