altool failed upload with Error: Unable to authenticate. (-19209)

altool seemed to be working correctly, but then failed after upload finished:

$ xcrun altool --upload-package ../exports/OurApp.ipa --type ios --apple-id <apple-id> --bundle-id <bundle-id> --bundle-version 291 --bundle-short-version-string "3.1.5" --apiKey <api-key> --apiIssuer <issuer> --show-progress 
Getting list of providers...
Beginning delivery...
Analyzing package…
Requesting app information…
Requesting asset description upload id…
Sending analysis to the App Store…
Waiting for response…
Requesting upload instructions from the App Store…
Preparing to upload package to the App Store…
Uploading package to the App Store…
**status code 401, auth issue.                                                  



*** Error: *** status code 401, auth issue.                                     



*** Error: Error uploading '../exports/OurApp.ipa'.                    
*** Error: Unable to authenticate. (-19209)

Note that --list-providers seems to work just fine with the same credentials:

$ xcrun altool --list-providers --apiKey <key> --apiIssuer <issuer>
Getting list of providers...
ProviderName ProviderShortname PublicID                             WWDRTeamID 
------------ ----------------- ------------------------------------ ---------- 
Whatnot Inc. <redacted>         <redacted>                          <redacted> 

@eskimo?

Interestingly, running --upload-package a second time, hours later, results in this:

Getting list of providers...

Beginning delivery...

Resuming package upload to the App Store… Requesting upload instructions from the App Store… Completing upload… File 'OurApp.ipa' complete. Uploaded asset is processing. No errors uploading '../exports/OurApp.ipa'

And the app is now uploaded and processing.

This problem {-19209} has been bothering me for a long time, and it has not been solved.

Same -19209 problem for a long time. Sometimes it succeeds, most time it fails.

My team has been seeing this as well. It seems like the majority of the time it fails.

Were you folks able to figure out a solution or a workaround to this? Is it on Apple's side?

We're also seeing this, but only on apps with ODR bundles enabled. The upload completes happily after a couple of minutes, but then the authorisation fails. If the problem were with the API keys, I would expect it to fail before it attempts the upload.

`==================== = File: <Filepath> = eTag: cf0451648383f82d2d0abfcf0c40f3db

==================== Exiting uploadUsingVBTxWithUploadOperations: jsonRequest as dictionary = { data = { attributes = { items = ( { correlationKey = ""; kpiValue = "1.508335e+07"; kpiValueType = Counter; level = INFO; message = "bytesSent:2345032300 bytesLost:0 partsSent:35 retryCount:0 failureCount:0 elapse\U2026"; name = "VoiceBoxClient - Upload throughput (bytes/sec)"; timestamp = "2022-03-08T14:29:14.154Z"; } ); sourceApplication = altool; }; type = metricsAndLogging; }; }

==================== = URL: https://contentdelivery.itunes.apple.com/MZContentDeliveryService/iris/v1/metricsAndLogging = status code: 401

**status code 401, auth issue.

jsonRequest as dictionary = { data = { attributes = { uploaded = 1; }; id = ""; type = buildDeliveryFiles; }; }

URL: https://contentdelivery.itunes.apple.com/MZContentDeliveryService/iris/v1/buildDeliveryFiles/ status code: 401 *** Error: *** status code 401, auth issue. `

We had this problem for months, sometimes it succeeds, most of the time it fails. Updating Xcode to the latest version solved the issue (I'm on MacOS Monterey)

altool failed upload with Error: Unable to authenticate. (-19209)
 
 
Q