I did another test on two different machines seemingly configured in the same way (macOS 26.4.1, Xcode 26.5), and got divergent results. These are the steps I've taken in each case:
In System Preferences > Privacy & Security, remove Xcode from Full Disk Access and Files & Folders.
Reboot.
Open a project under the Documents folder. The user is prompted to grant Xcode access to the Documents folder. If access is denied, Xcode correctly reports that it doesn't have permissions to open the project (Xcode can still create new projects inside Documents, but I assume that this is expected behavior).
In System Preferences > Privacy & Security > Files & Folder, grant Xcode access to the Documents folder.
Restart Xcode and reopen the same project. The project can now be opened.
At this point, in one machine the preview shows up correctly, but in the other machine I get the “Failed to launch” error I've originally posted, and I need to apply one of the workarounds I've originally mentioned (move the project folder or toggle automatic refresh) to be able to see the previews.
So, I cannot reproduce the issue consistently: there is something else going on in one of my machines, but I don't know how to debug it further.
PS: Glad to know that the interaction is with humans making genuine mistakes! If you ever implement bots in this forum, I hope that they will clearly marked as such. My apologies to the engineers if my reply sounded harsh.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: