I upgraded the OS two weeks ago (Sequoia 15.0 to 15.1), but it still failed to build the IPA file. I initially thought that upgrading the OS wouldn't help.
Today, I checked for updates to both the OS and Xcode. There was an available update (OS 15.2 and Xcode 16.2). After upgrading the OS and Xcode, and then rebooting, the error message disappeared.
Always ensure that your OS and Xcode are up to date.