Quick answer: Close Firefox, open your profile folder, rename or delete sessionstore.jsonlz4, then relaunch Firefox.
I've seen this exact thing happen to a client last month—their entire office thought they'd been hacked because Firefox kept flashing on and off. The real culprit was a corrupted session restore file. Firefox saves your open tabs every 15 seconds into a file called sessionstore.jsonlz4. If that file gets half-written (power loss, hard crash, or a bad extension update), Firefox tries to read it on startup, fails, and then restarts itself in a loop. It's not a virus, it's not a browser bug—it's just a tiny JSON file that's now garbage.
Here's the fix. Took me about two minutes on that client's machine.
Step-by-step fix
- Force-quit Firefox. On Windows, hit Ctrl+Shift+Esc, find Firefox in the Processes tab, and select End Task. On Mac, press Cmd+Option+Esc and Force Quit. On Linux, run
pkill firefoxin a terminal. You have to make sure it's completely closed or the file will still be locked. - Open your profile folder. The fastest way: press Win+R (Windows) or Cmd+Shift+G (Mac) and paste this:
%APPDATA%\Mozilla\Firefox\Profiles\
On Windows, that expands to C:\Users\[YourUsername]\AppData\Roaming\Mozilla\Firefox\Profiles\. You'll see one or more folders with names like abcd1234.default-release. Pick the one that has a sessionstore.jsonlz4 file inside.
On Mac, go to ~/Library/Application Support/Firefox/Profiles/. On Linux, ~/.mozilla/firefox/.
- Rename (don't delete) the file. Right-click
sessionstore.jsonlz4and rename it tosessionstore.jsonlz4.old. Renaming is safer because if something else goes wrong, you can revert. Deleting works too, but renaming costs you nothing extra. - Launch Firefox. It should open normally with a fresh session. You'll lose the tabs you had open—sorry, that's the trade-off. But you can recover them from the renamed file if you want.
If that doesn't work
Sometimes the loop is caused by a different file. Same folder, look for sessionstore-backups/ directory. Inside there are previous versions like previous.jsonlz4. Copy that file back into the main profile folder and rename it to sessionstore.jsonlz4. That'll restore your tabs from the last good save.
If Firefox still loops, do this:
- Open Firefox in Safe Mode (hold Shift while clicking the Firefox icon). If it opens, the problem is an extension. Disable all, then re-enable one by one.
- If Safe Mode also loops, your profile is deeper corrupted. Create a new profile via
firefox -Pin the Run dialog, then set it as default. You'll lose your bookmarks unless you exported them.
Preventing this from happening again
The number one cause is Firefox crashing hard while writing that file. So keep Firefox updated—they've hardened the session writer over the years. Also, avoid killing Firefox with Task Manager when you're just annoyed at it. Let it close properly.
You can also change how often Firefox saves your session. Type about:config in the address bar, accept the risk, and search for browser.sessionstore.interval. Default is 15000 (milliseconds). Bump it up to 30000 to write less frequently, which reduces the chance of corruption during a crash. It won't eliminate it, but it helps.
That's the whole story. It's a stupid little file, but it can bring your whole day to a halt. Now you know exactly what to do when it happens.