In Xcode 15.3 I had the same error, and I solved it cleaning the Xcode storage
Settings > Storage > Developer
Clean the Xcode Project Build Files.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: