I also had this error within an SPM target. I solved this by switching my scheme to the package that holds the file I am trying to preview.
Post
Replies
Boosts
Views
Activity
Still and issue on 14.1
Thank you. Fixed my issue.