#30293·fastlane

[spaceship] Legacy App Store Connect calls return nil when an endpoint is gone

Author: lacostejCreated Sep 29, 2026Updated Sep 29, 2026

TunesClient#handle_itc_response starts with:

ruby
return unless raw
return unless raw.kind_of?(Hash)

and the request layer does not raise on a 404. So when Apple answers with an HTML error page, the method returns nil without looking at the HTTP status, and the caller cannot tell the endpoint is gone. It is used 31 times in TunesClient.

Seen with an Apple ID, on an app with a TestFlight build:

GET ra/apps/{id}/buildHistory -> 404 (HTML page)            all_build_trains returns nil
GET ra/apps/{id}/trains/{train}/buildHistory -> 404 (HTML)  all_builds_for_train returns nil
GET ra/apps/{id}/trains/ -> 404                             build_trains raises UnexpectedResponse

Proposal: fail on an error status or a non-JSON body in handle_itc_response, with the method and URL in the message, rather than returning nil. The three build-listing methods above appear to be gone at Apple and are not used by any fastlane tool; Spaceship::ConnectAPI.get_builds covers them.