What fails, and why
With no key left, the car has to accept a new key with nothing to copy from, and that is the job where dealer quotes grow. Owners on Reddit's r/subaru describe the answer in two forms: replace the module, or "pull the modules and send them off" while the car sits at the dealer.
A module job bills parts and hours where a key job bills a key. Programming labor is often its own line, $100 to $180; a Subaru with no key rides to the service department on a tow truck, $125 to $200; and modules sent away keep the car parked for days. The dealer quotes owners posted for a lost key: $1,700 for a 2016 Forester and about $2,000 for a 2014 Forester. A locksmith reported a dealer quote of over $3,000 on a push-button Subaru.
The other route leaves the modules in place and registers a new key to the immobilizer the car already has. Push-button Subarus from 2020 on add steps, the factory alarm first among them, so those are confirmed by VIN before the van heads out.