Digital Experiences are turned on via the communities feature switch in the scratch org definition. But that feature switch does not make the "Guest User License" type available that is needed for the profile used before a user logs in. So this conventional sequence:
- Create scratch org
- Push all metadata including both the Digital Experience and a "Guest User License" profile used before users have logged in
fails because the "Guest User License" is only available after the push has completed as it appears to be added when the first Digital Experience is created in the org.
Apart from doing 2 separate pushes, how can this problem be avoided?