fastlane: Any lane failing with code 65 (error: Unexpected duplicate tasks)

New Issue Checklist

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 image

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (3 by maintainers)

Commits related to this issue

Most upvoted comments

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:

Screen Shot 2022-06-08 at 7 16 46 AM

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.

So what’s the solution?

Is there any fix or should we abandon Fastlane.Swift altogether at the moment?

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'

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