Any lane failing with code 65 (error: Unexpected duplicate tasks)
New Issue Checklist
- [x] Updated fastlane to the latest version
- [x] I read the Contribution Guidelines
- [x] I read docs.fastlane.tools
- [x] I searched for existing GitHub issues
Issue Description
Using Fastlane Swift!
Fail running any lane, no matter even if it's empty, with a very generic error:
❌ error: Unexpected duplicate tasks:
❌ error: Unexpected duplicate tasks:
Command executed
bundle exec fastlane custom --verbose
Complete output when running fastlane, including the stack trace and command used
Captured Output
Command Used: aLane --verbose --capture_output
Output/Log
DEBUG [2022-03-23 01:42:25.84]: Checking if there are any plugins that should be loaded...
DEBUG [2022-03-23 01:42:25.84]: Loading 'fastlane-plugin-firebase_app_distribution' plugin
INFO [2022-03-23 01:42:25.84]: gem 'fastlane-plugin-firebase_app_distribution' is already installed
🚫 fastlane environment 🚫
Stack
| Key | Value |
|---|---|
| OS | 12.0.1 |
| Ruby | 2.6.8 |
| Bundler? | true |
| Git | git version 2.32.0 (Apple Git-132) |
| Installation Source | ~/Downloads/testing_fastlane/vendor/bundle/ruby/2.6.0/bin/fastlane |
| Host | macOS 12.0.1 (21A559) |
| Ruby Lib Dir | /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib |
| OpenSSL Version | LibreSSL 2.8.3 |
| Is contained | false |
| Is homebrew | false |
| Is installed via Fabric.app | false |
| Xcode Path | /Applications/Xcode.app/Contents/Developer/ |
| Xcode Version | 13.2.1 |
| Swift Version | 5.5.2 |
System Locale
| Error |
|---|
| No Locale with UTF8 found 🚫 |
fastlane files:
`./fastlane/Fastfile.swift`
// This file contains the fastlane.tools configuration
// You can find the documentation at https://docs.fastlane.tools
//
// For a list of all available actions, check out
//
// https://docs.fastlane.tools/actions
//
import Foundation
class Fastfile: LaneFile {
func releaseLane() {
desc("Push a new release build to the App Store")
incrementBuildNumber(xcodeproj: "testing_fastlane.xcodeproj")
buildApp(scheme: "testing_fastlane")
uploadToAppStore(username: "redacted", appIdentifier: "redacted", skipScreenshots: true, skipMetadata: true)
}
func aLane() {
desc("increments builds number")
incrementBuildNumber(xcodeproj: "testing_fastlane.xcodeproj")
}
func bLane() {
desc("increments builds number")
firebaseAppDistribution(app: "redacted", releaseNotes: "dev build", debug: true)
}
}
No Appfile found
fastlane gems
| Gem | Version | Update-Status |
|---|---|---|
| fastlane | 2.205.0 | ✅ Up-To-Date |
Loaded fastlane plugins:
| Plugin | Version | Update-Status |
|---|---|---|
| fastlane-plugin-firebase_app_distribution | 0.3.3 | ✅ Up-To-Date |
Loaded gems
| Gem | Version |
|---|---|
| did_you_mean | 1.3.0 |
| bundler | 2.3.9 |
| rake | 13.0.6 |
| rexml | 3.2.5 |
| CFPropertyList | 3.0.5 |
| public_suffix | 4.0.6 |
| addressable | 2.8.0 |
| artifactory | 3.0.15 |
| atomos | 0.1.3 |
| aws-eventstream | 1.2.0 |
| aws-partitions | 1.568.0 |
| aws-sigv4 | 1.4.0 |
| jmespath | 1.6.1 |
| aws-sdk-core | 3.130.0 |
| aws-sdk-kms | 1.55.0 |
| aws-sdk-s3 | 1.113.0 |
| babosa | 1.0.4 |
| claide | 1.1.0 |
| colored | 1.2 |
| colored2 | 3.1.2 |
| highline | 2.0.3 |
| commander | 4.6.0 |
| declarative | 0.0.20 |
| digest-crc | 0.6.4 |
| unf_ext | 0.0.8.1 |
| unf | 0.1.4 |
| domain_name | 0.5.20190701 |
| dotenv | 2.7.6 |
| emoji_regex | 3.2.3 |
| excon | 0.92.1 |
| faraday-em_http | 1.0.0 |
| faraday-em_synchrony | 1.0.0 |
| faraday-excon | 1.1.0 |
| faraday-httpclient | 1.0.1 |
| multipart-post | 2.0.0 |
| faraday-multipart | 1.0.3 |
| faraday-net_http | 1.0.1 |
| faraday-net_http_persistent | 1.2.0 |
| faraday-patron | 1.0.0 |
| faraday-rack | 1.0.0 |
| faraday-retry | 1.0.3 |
| ruby2_keywords | 0.0.5 |
| faraday | 1.10.0 |
| http-cookie | 1.0.4 |
| faraday-cookie_jar | 0.0.7 |
| faraday_middleware | 1.2.0 |
| fastimage | 2.2.6 |
| gh_inspector | 1.1.3 |
| jwt | 2.3.0 |
| memoist | 0.16.2 |
| multi_json | 1.15.0 |
| os | 1.1.4 |
| signet | 0.16.1 |
| googleauth | 1.1.2 |
| httpclient | 2.8.3 |
| mini_mime | 1.1.2 |
| trailblazer-option | 0.1.2 |
| uber | 0.1.0 |
| representable | 3.1.1 |
| retriable | 3.1.2 |
| webrick | 1.7.0 |
| google-apis-core | 0.4.2 |
| google-apis-androidpublisher_v3 | 0.16.0 |
| google-apis-playcustomapp_v1 | 0.7.0 |
| google-apis-iamcredentials_v1 | 0.10.0 |
| google-apis-storage_v1 | 0.11.0 |
| google-cloud-env | 1.5.0 |
| google-cloud-errors | 1.2.0 |
| google-cloud-core | 1.6.0 |
| google-cloud-storage | 1.36.1 |
| json | 2.6.1 |
| mini_magick | 4.11.0 |
| naturally | 2.2.1 |
| optparse | 0.1.1 |
| plist | 3.6.0 |
| rubyzip | 2.3.2 |
| security | 0.1.3 |
| simctl | 1.6.8 |
| terminal-notifier | 2.0.0 |
| unicode-display_width | 1.8.0 |
| terminal-table | 1.8.0 |
| tty-screen | 0.8.1 |
| tty-cursor | 0.7.1 |
| tty-spinner | 0.9.3 |
| word_wrap | 1.0.0 |
| nanaimo | 0.3.0 |
| xcodeproj | 1.21.0 |
| rouge | 2.0.7 |
| xcpretty | 0.3.0 |
| xcpretty-travis-formatter | 1.0.1 |
| fastlane-plugin-firebase_app_distribution | 0.3.3 |
generated on: 2022-03-23
EDIT: I have struggled an entire day with this. I think I might know at least the root cause of it. Not sure how to fix it yet though. App-FastlaneRunner.log
Later EDIT:
I have removed FastlaneRunner from Build Phases -> Copy Files section and it finally made the error go away, but I am unsure of the implications

I have this behaviour on an M1 mac. I have an intel based macbook as well and I got paranoid and did a fresh install of the OS and was able to reproduce it there as well. Not sure how other people are not getting it either, or if I am doing something wrong. But I am just doing the most basic steps and able to repro every time 🤷♂️
Last EDIT (I promise): It's most probably an Xcode issue. more specifically - the latest one (13.3) I built it with Xcode 13.0 and it doesn't have the Copy resources option, like 13.3 has
So what's the solution?
Is there any fix or should we abandon Fastlane.Swift altogether at the moment?
I just started my fastlane integration and noticed, that fastlane asks on lane execution if I want to update the FastlaneSwiftRunner project. If I deny this fastlane runs, if I accept it, I get this error.
So I added fastlane swift to my project and will run for now with --disable_runner_upgrades
Thank you for this tip. With --disable_runner_upgrades it now works again.
fastlane snapshot --disable_runner_upgrades invalid option: --disable_runner_upgrades
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest fastlane version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:
Friendly reminder: contributions are always welcome! Check out CONTRIBUTING.md for more information on how to help with fastlane and feel free to tackle this issue yourself :muscle:
This issue will be auto-closed if there is no reply within 1 month.
@danipralea I have Xcode 13.2.1 and have the same problem. Even --disable_runner_upgrades does not solve the problem
If you run the underlying xcodebuild command, the problem becomes apparent quite quickly:
xcodebuild -scheme FastlaneRunner -project ./fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj -destination 'generic/platform=macOS' build
error: Unexpected duplicate tasks
note: Target 'FastlaneRunner' (project 'FastlaneSwiftRunner'): CodeSign /Users/brendanconron/Projects/split-watch-os/fastlane/FastlaneRunner
note: Target 'FastlaneRunner' (project 'FastlaneSwiftRunner'): CodeSign /Users/brendanconron/Projects/split-watch-os/fastlane/FastlaneRunner
error: Unexpected duplicate tasks
note: Target 'FastlaneRunner' (project 'FastlaneSwiftRunner') has copy command from '/Users/brendanconron/Library/Developer/Xcode/DerivedData/FastlaneSwiftRunner-dxdyqdabmrhojbbisfwfdasjwhny/Build/Products/Debug/FastlaneRunner' to '/Users/brendanconron/Projects/split-watch-os/fastlane/FastlaneRunner'
note: Target 'FastlaneRunner' (project 'FastlaneSwiftRunner') has copy command from '/Users/brendanconron/Library/Developer/Xcode/DerivedData/FastlaneSwiftRunner-dxdyqdabmrhojbbisfwfdasjwhny/Build/Products/Debug/FastlaneRunner' to '/Users/brendanconron/Projects/split-watch-os/fastlane/FastlaneRunner'
The underlying Fastlane project has two copy files phase that both copy the same file:
Both copy phases do exactly the same thing, the only difference being their name. I was able to get my fastlane scripts to run by deleting either one of the phases, which of course makes fastlane complain that it's not up to date. I would assume this is a bug in the implement of FastlaneRunner but I would be curious to get context from the implementer as to why there's two copy phases in the Xcode project.
Facing the same issues. The runner is being upgraded every few days but the error remains. Can we simply just open a PR to remove the redundant copying step?
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest fastlane version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:
Friendly reminder: contributions are always welcome! Check out CONTRIBUTING.md for more information on how to help with fastlane and feel free to tackle this issue yourself :muscle:
This issue will be auto-closed if there is no reply within 1 month.
@4rihant it seems likely that will fix the issue but it's hard to say without one of the core contributors weighing in.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest fastlane version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:
Friendly reminder: contributions are always welcome! Check out CONTRIBUTING.md for more information on how to help with fastlane and feel free to tackle this issue yourself :muscle:
This issue will be auto-closed if there is no reply within 1 month.
The issue seems to remain as of now
I think what would fix this is the swift_runner_upgrader.rb file checking for and deleting the un-named Copy Files build phase. Right now, it looks for an "old" build phase that was used to copy the signed executable, but it's not removing the problematic, duplicate, generic "Copy Files" build phase (which can be found in the initial xcode project downloaded when installing Fastlane, see: https://github.com/fastlane/fastlane/blob/master/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.pbxproj#L30)
I haven't had a chance to build and test this, but roughly, in this part of swift_runner_upgrader.rb, we need to add two lines to make sure the problematic copy files phase is removed:
def add_missing_copy_phase!(dry_run: false)
# Check if upgrade is needed
# If fastlane copy files build phase exists already, we don't need any more changes to the Xcode project
phase_copy_sign = self.fastlane_runner_target.copy_files_build_phases.select { |phase_copy| phase_copy.name == "FastlaneRunnerCopySigned" }.first
old_phase_copy_sign = self.fastlane_runner_target.shell_script_build_phases.select { |phase_copy| phase_copy.shell_script == "cd \"${SRCROOT}\"\ncd ../..\ncp \"${TARGET_BUILD_DIR}/${EXECUTABLE_PATH}\" .\n" }.first
# ⚠️⚠️⚠️⚠️ ADD THIS 👇🏻 ⚠️⚠️⚠️⚠️
other_old_phase_copy_sign = self.fastlane_runner_target.copy_files_build_phases.select { |phase_copy| phase_copy.name != "FastlaneRunnerCopySigned" }.first
return true if dry_run && phase_copy_sign.nil?
return false if dry_run
# Proceed to upgrade
old_phase_copy_sign.remove_from_project unless old_phase_copy_sign.nil?
# ⚠️⚠️⚠️⚠️ AND THIS 👇🏻 ⚠️⚠️⚠️⚠️
other_old_phase_copy_sign.remove_from_project unless other_old_phase_copy_sign.nil?
[... rest of function ...]
end
ALTERNATIVELY
It occurred to me while writing the above fix, that if the xcode project that comes with fastlane already has a proper Copy Files build phase, we don't need to add this new FastlaneRunnerCopySigned-named phase. Can we just get rid of this missing-build-phase-adder?
This is still the problem unfortunately ;O
If you run the underlying
xcodebuildcommand, the problem becomes apparent quite quickly:
xcodebuild -scheme FastlaneRunner -project ./fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj -destination 'generic/platform=macOS' builderror: Unexpected duplicate tasks note: Target 'FastlaneRunner' (project 'FastlaneSwiftRunner'): CodeSign /Users/brendanconron/Projects/split-watch-os/fastlane/FastlaneRunner note: Target 'FastlaneRunner' (project 'FastlaneSwiftRunner'): CodeSign /Users/brendanconron/Projects/split-watch-os/fastlane/FastlaneRunner error: Unexpected duplicate tasks note: Target 'FastlaneRunner' (project 'FastlaneSwiftRunner') has copy command from '/Users/brendanconron/Library/Developer/Xcode/DerivedData/FastlaneSwiftRunner-dxdyqdabmrhojbbisfwfdasjwhny/Build/Products/Debug/FastlaneRunner' to '/Users/brendanconron/Projects/split-watch-os/fastlane/FastlaneRunner' note: Target 'FastlaneRunner' (project 'FastlaneSwiftRunner') has copy command from '/Users/brendanconron/Library/Developer/Xcode/DerivedData/FastlaneSwiftRunner-dxdyqdabmrhojbbisfwfdasjwhny/Build/Products/Debug/FastlaneRunner' to '/Users/brendanconron/Projects/split-watch-os/fastlane/FastlaneRunner'The underlying Fastlane project has two copy files phase that both copy the same file:
![]()
Both copy phases do exactly the same thing, the only difference being their name. I was able to get my fastlane scripts to run by deleting either one of the phases, which of course makes fastlane complain that it's not up to date. I would assume this is a bug in the implement of
FastlaneRunnerbut I would be curious to get context from the implementer as to why there's two copy phases in the Xcode project.
Same problem, deleting one of the files above solved it but I guess that when I do the upgrade again it will come back...
Same problem here. Just integrated Fastlane in the project but this buggy tool not working from the box.
`
iMac-Argus:Motiv-iOS-Sources argus$ fastlane -v [✔] 🚀 fastlane 2.213.0
iMac-Argus:Motiv-iOS-Sources argus$ fastlane test --disable_runner_upgrades [✔] 🚀 [12:54:44]: fastlane detected a Gemfile in the current directory [12:54:44]: However, it seems like you didn't use bundle exec [12:54:44]: To launch fastlane faster, please use [12:54:44]: [12:54:44]: $ bundle exec fastlane test --disable_runner_upgrades [12:54:44]: [12:54:44]: Get started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile [12:54:45]: FastlaneSwiftRunner project is up-to-date [12:54:45]: Resolving Swift Package Manager dependencies... [12:54:45]: $ xcodebuild -resolvePackageDependencies -scheme FastlaneRunner -project ./fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj ... [12:48:01]: $ xcodebuild -showBuildSettings -scheme FastlaneRunner -project ./fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj 2023-06-02 12:48:02.147 xcodebuild[8809:179036] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled) [12:48:02]: $ set -o pipefail && xcodebuild -scheme FastlaneRunner -project ./fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj -destination 'generic/platform=macOS' build | tee /Users/argus/Library/Logs/gym/App-FastlaneRunner.log | xcpretty 2023-06-02 12:48:03.321 xcodebuild[8818:179154] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
❌ error: Unexpected duplicate tasks
❌ error: Unexpected duplicate tasks
** BUILD FAILED ** [12:54:48]: Exit status: 65 [12:54:48]: fastlane finished with errors `
@KrauseFx can we get some eyes from the team on this issue to understand the ideal solution for the duplicated task warning within the Build Phases?
Any update on this?
Hello 👋
Thank you for providing plenty of details related to the issue. It's been very helpful. You can find the pull request with a fix here: https://github.com/fastlane/fastlane/pull/21621.
Feel free to take it for a spin by pinning your fastlane version to the one on a branch that fixes the issue:
// Gemfile
gem 'fastlane', git: 'https://github.com/fastlane/fastlane.git', branch: 'fix-swift-unexpected-duplicate-tasks'