Music Library Seems Broken Recently, I noticed whenever I try to open my Music library, I get the following error message:

The file &quot;Application.musicdb&quot; cannot be read because it does not
appear to be a valid library file.

The app continues to work however but things are a bit slow. And I tried to look into the library file, by clicking on &quot;show package contents&quot; and I can see the mentioned file inside the library but the last modified date shows a couple of weeks back. And I can see more than ~400 temp files (Temp File 1.tmp and so on) are created over the course of the past two weeks, the last one belonging to a few minutes ago. It seems that all the recent modifications are happening via these temp files and the original file, which the app complains about at the start, hasn't been updated.
What can I do to fix this? Is there a proper way to force it to recreate that file or something?
I'm using the latest version of the OS and the Music app and I keep my music library on an external hard drive.
I managed to fix the issue by replacing the problematic file with another one from another music library.
I asked the Music app to create a new library (by holding the option key while opening the app). I have an Apple Music subscription and I have my music files uploaded to the cloud. I looked into the library file by clicking on &quot;show package contents&quot; and then copied Application.musicdb (the file that causes the issue in my main library ) into my main library to replace the problematic file. Then I closed the Music app and opened my main library and everything worked fine. I also deleted all the temp files and the app has been working fine since then.
Hope this helps others with the same problem.