Firefox on MacOS Big Sur (11.4)
I was living with this problem for over a month, hoping that a new version of Firefox will come and it will be fixed. I didn't, at least until version 89.0.2, July 2021 92.0 Sep 2021, that I am currently on.
Why is it happening?
As other answers mention, it happens when your machine crashes and Firefox leaves its sqlite storage files in a broken state on disk. Yes, Mozilla should have been more resilient, but it's not. :(
What should I do now?
I downloaded and reinstalled Firefox and cleared ~/Library/Firefox
and ~/Library/Mozilla
and they didn't help either.
I have found that you have 3 solutions to try. Depending on how severe the damaged file is, one of them might work.
Solution 1: Clear localStorage and sessionStorage
Hit F12 (Tools > Browser Tools > Browser Console) and paste
localStorage.clear();sessionStorage.clear()
I have a bookmarklet for it solution (as mentioned on the other answer.) My bookmarklet is javascript:localStorage.clear();sessionStorage.clear();
and I hit it every time I was running into a page that not responding and the console (F12) in Firefox was showing this NS_ERROR_FILE_CORRUPTED
error.
However, it is so annoying and this solution isn't working on certain websites (e.g. AWS, or Jira).
Solution 2: Manual deletion of certain sqlite files
Based on the other answers (and the comment from TheConstructor), here is what you can do in terminal:
- Go to
~/Library/Application Support/Firefox/Profiles/
ls -al
and then cd
into the folder that's touched recently. (If you have a Mozilla account to sync bookmarks and password with your phone, you are NOT on default.)
- Run
for i in $(find . -name '*.sqlite'); do echo "$i"; echo "PRAGMA integrity_check;" | sqlite3 -bail "$i" 2>&1; done | grep -v ok | grep -v locked
and look for any output that's not a ./xxx/yyy.sqlite
. (e.g. Main freelist: size is 0 but should be 4
.) The file above the error is the corrupted file.
- Move corrupted file(s) away. (either
rm
them, or mv
somewhere else.)
- Restart Firefox. (I have a bookmark to
about:restartrequired
which is handy.)
It should hopefully fix the issue with minimal damage.
Solution 3: Clear Profile Folder (and then Restore your Profile)
If solution 2 doesn't work, you have to clear the entire local data for the profile.
It was crucial for me not to lose my bookmarks and passwords in Firefox.
Here is what finally worked for me:
Make sure you create an account in Mozilla/Firefox and turn on Syncing. (top right button.)
Optional: It's helpful to install Firefox on your phone and sync to make sure you have a live backup of your data and you are not losing passwords and bookmarks if things go wrong.
Open Finder. Go to ~/Library/Application Support
. Move Firefox
folder to trash.
Restart Firefox. (I have a bookmark for about:restartrequired
that comes handy.)
Relogin to your profile in Firefox and sync.
Caveats
- Your bookmarks are going to be out of order in the bookmark bar, and their icons are going to be blank until your first visit.
- You have to login to every account (e.g. GMails) manually and one by one. It should be straightforward if you have the passwords saved.