I did a cabal build in one of my projects, and then I encountered this error. cabal clean && cabal build fixed the issue.
cabal build
cabal clean && cabal build
GHC version: 9.8.1
Operating System: macOS 14.3.1
System Architecture: Arm