I'm trying to export an iOS app archive using xcodebuild from Xcode 13.1, but the export is failing with the following exception:
$ xcodebuild -exportArchive -exportOptionsPlist exportPlist.plist -archivePath [REDACTED] -exportPath build/
2021-11-01 11:52:03.141 xcodebuild[2234:1268877] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path "/var/folders/y0/9yktphk14bj_rfljxbhbd40c0000gn/T/[REDACTED]".
2021-11-01 11:52:34.646 xcodebuild[2234:1268877] -[NSNull path]: unrecognized selector sent to instance 0x7fff80701eb0
** INTERNAL ERROR: Uncaught exception **
Uncaught Exception: -[NSNull path]: unrecognized selector sent to instance 0x7fff80701eb0
Stack:
0 __exceptionPreprocess (in CoreFoundation)
1 objc_exception_throw (in libobjc.A.dylib)
2 -[NSObject(NSObject) __retain_OA] (in CoreFoundation)
3 ___forwarding___ (in CoreFoundation)
4 _CF_forwarding_prep_0 (in CoreFoundation)
5 -[IDEDistributionProcessingPipeline process:] (in IDEFoundation)
6 -[IDEDistributionPackagingStep loadFromExportOptions:error:] (in IDEFoundation)
7 -[IDEDistributionDriver runWithDestinationPath:error:] (in IDEFoundation)
8 -[Xcode3CommandLineBuildTool _distributeArchiveAndExit] (in Xcode3Core)
9 -[Xcode3CommandLineBuildTool run] (in Xcode3Core)
10 main (in xcodebuild)
11 start (in libdyld.dylib)
[1] 2234 abort xcodebuild -exportArchive -exportOptionsPlist fastlane/exportPlist.plist