Can't restore previous session, "recently closed windows" grayed out
Hi
I had two Firefox windows open. One with 100+ tabs and the other with 1 tab. I closed the Firefox with 100 tabs, and then closed the one with 1 tab, without thinking. I then realised that I should have closed them in the opposite order, because I want the 100 tabs to get restored.
I opened Firefox again and was dismayed to see just the single tab get restored. I did some searching and backed up the "sessionstore-backups" folder.
I then tried to close Firefox and replace sessionstore.jsonlz4 with previous.jsonlz4 from the backed up "sessionstore-backups" folder. This did not work, as when I opened Firefox I still only got the 1 tab back and "recently closed windows" remains grayed out. Ctrl+Shift+N does nothing as well.
I used https://www.jeffersonscher.com/ffu/scrounger.html to inspect the backed up previous.jsonlz4 file and it shows
Open Windows Open Window 1 Tab 1 [...]
Closed Windows Closed Window 1 Tab 1 [...] [...] Tab 125 [...]
So the previous.jsonlz4 file does contain my mistakenly closed window but I can't get Firefox to restore the tabs!
Can anyone please help me get my tabs back? I'm on Firefox v96.0.1.
Chosen solution
I went full desperation mode and did some manual editing of the sessionstore.jsonlz4 using https://github.com/jusw85/mozlz4
Extract the JSON from previous.jsonlz4
- Download mozlz4 (I downloaded for Windows). For convenience I renamed the downloaded file to mozlz4.exe.
- Place the exe in the folder with your backed up copy of sessionstore-backups
- Open a terminal in this folder
- Run mozlz4 --extract "previous.jsonlz4" > previous-extracted.json
Use a text editor to format the extracted JSON and replace the "windows" element with the contents of "_closedWindows".
- Open https://vscode.dev/ or open VS Code or equivalent text editor that can format JSON. (The next few steps assume VS Code.)
- Open previous-extracted.json in the text editor (can drag and drop into https://vscode.dev)
- Top left menu > View > Command Palette (or press F1)
- Type "language" and then select "Change Language Mode". Type "json" and select the "JSON" option.
- Open command palette again (F1). Type "format doc" and then select the "Format document" option (or press Shift + Alt + F).
- Open command palette again (F1). Type "fold all" and then select "Fold All".
- Now expand the root node (click arrow in left margin of editor).
- Expand "windows" and "_closedWindows" twice to see their inner items like "tabs", "selected", "_closedTabs", etc.
- Copy the line from "windows" that says: "_shouldRestore": true,
- Paste this line into the "_closedWindows" section just below "title".
- Copy the entire "_closedWindows" section by selecting everything from its opening bracket "[" to the closing bracket "]".
- Select the entire "windows" section, starting from its opening bracket "[" to its closing bracket "]" and then paste the "_closedWindows" section that you just copied.
- Save this file as previous-extracted-modified.json. Save it with mozlz4 in the session-backup folder.
Re-compress your modified sessionstore.jsonlz4 and place it into your Firefox profile to restore the closed windows.
- In the terminal window, and run: mozlz4 --compress "previous-extracted-modified.json" > sessionstore.jsonlz4
- Open your Firefox profile folder (about:support > Open Profile folder).
- Close Firefox so that the sessionstore.jsonlz4 file will be present in the profile folder.
- Delete, move or rename sessionstore.jsonlz4 in the base profile folder and all the files in the sessionstore-backups folder.
- Paste your modified sessionstore.jsonlz4 into the base profile folder.
- Open Firefox and the closed window will be restored.
All Replies (5)
You may have corrupt sessionstore [v56] sessionstore.jsonlz4 file(s). Delete all sessionstore* files and the sessionstore-backups folder.
Don't delete the files if you need to rescue any data from them, just move them out of the profile folder to some location where Firefox doesn't look for them. You can try to read out their contents using this tool: https://www.jeffersonscher.com/res/scrounger.html
Type about:support<enter> in the address box.
Under the page logo on the left side, you will see Application Basics. Under this find Profile Folder. To its right press the button Show Folder. This will open your file browser to the current Firefox profile. Now Close Firefox.
Windows: Show Folder; Linux: Open Directory; Mac: Show in Finder
Linux: Under the page logo on the left side, you will see Application Basics. Under this find Profile Directory. To its right press the button Open Directory.
Locate the above file. Then rename or delete it. Restart Firefox.
Hmm, usually that "manual swap" of the old file in place of the new one does work.
Did the Scrounger output indicate that the closed window was in a embedded session? Unfortunately Firefox doesn't "see" those. There is a button on the page to export out that part of the session to a file you can drop into your profile folder as sessionstore.js (the old name before the LZ4 compression was applied).
You may need to hide the other session files/folders before Firefox will look for that older file name. Of course, all this should be done with Firefox closed or you'll lose your changes at shutdown.
Right-click > Rename the following files to hide them from Firefox (or you could move them out of the folder or delete them):
- sessionstore.jsonlz4 => sessionstoreOLD.jsonlz4
- sessionCheckpoints.json => sessionCheckpointsOLD.json
Right-click > Rename the following folder to hide it from Firefox (or you could move it out of the folder or delete it):
- sessionstore-backups => sessionstore-backupsOLD
Then drop in your substitute file. If it's a compressed file, use the .jsonlz4 extension and if it's an uncompressed file, use the .js extension.
Note: by default, Windows hides the .js extension, so you may need to set Windows to show all file extensions to confirm things are correct: https://www.bleepingcomputer.com/tutorials/how-to-show-file-extensions-in-windows/
> Did the Scrounger output indicate that the closed window was in a embedded session?
I checked the output and there is only 1 occurrence of "embedded" on the scrounger, which was on a grayed out button "Save Embedded Session". So I don't think it's an embedded session.
> You may need to hide the other session files/folders before Firefox will look for that older file name.
Tried renaming the folder and two session files (I had missed the sessionCheckpoints.json in a previous attempt). It still just restored the one tab.
Chosen Solution
I went full desperation mode and did some manual editing of the sessionstore.jsonlz4 using https://github.com/jusw85/mozlz4
Extract the JSON from previous.jsonlz4
- Download mozlz4 (I downloaded for Windows). For convenience I renamed the downloaded file to mozlz4.exe.
- Place the exe in the folder with your backed up copy of sessionstore-backups
- Open a terminal in this folder
- Run mozlz4 --extract "previous.jsonlz4" > previous-extracted.json
Use a text editor to format the extracted JSON and replace the "windows" element with the contents of "_closedWindows".
- Open https://vscode.dev/ or open VS Code or equivalent text editor that can format JSON. (The next few steps assume VS Code.)
- Open previous-extracted.json in the text editor (can drag and drop into https://vscode.dev)
- Top left menu > View > Command Palette (or press F1)
- Type "language" and then select "Change Language Mode". Type "json" and select the "JSON" option.
- Open command palette again (F1). Type "format doc" and then select the "Format document" option (or press Shift + Alt + F).
- Open command palette again (F1). Type "fold all" and then select "Fold All".
- Now expand the root node (click arrow in left margin of editor).
- Expand "windows" and "_closedWindows" twice to see their inner items like "tabs", "selected", "_closedTabs", etc.
- Copy the line from "windows" that says: "_shouldRestore": true,
- Paste this line into the "_closedWindows" section just below "title".
- Copy the entire "_closedWindows" section by selecting everything from its opening bracket "[" to the closing bracket "]".
- Select the entire "windows" section, starting from its opening bracket "[" to its closing bracket "]" and then paste the "_closedWindows" section that you just copied.
- Save this file as previous-extracted-modified.json. Save it with mozlz4 in the session-backup folder.
Re-compress your modified sessionstore.jsonlz4 and place it into your Firefox profile to restore the closed windows.
- In the terminal window, and run: mozlz4 --compress "previous-extracted-modified.json" > sessionstore.jsonlz4
- Open your Firefox profile folder (about:support > Open Profile folder).
- Close Firefox so that the sessionstore.jsonlz4 file will be present in the profile folder.
- Delete, move or rename sessionstore.jsonlz4 in the base profile folder and all the files in the sessionstore-backups folder.
- Paste your modified sessionstore.jsonlz4 into the base profile folder.
- Open Firefox and the closed window will be restored.
Is the current recovery.jsonlz4 file the same size as the previous.jsonlz4 file you renamed to sessionstore.jsonlz4? If so, I don't know why that window isn't listed under Recently Closed Windows. The only reason I know of for it to be missing is being in an embedded session.
At least you can use Save List on the Scrounger and restore tabs from the list as needed.