Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Restore previous session not working - can I repair recovery.bak?

more options

When I started Firefox it failed to restore my previous tabs and groups, and "Restore previous session" was greyed out. On previous occasions I have made a backup of my profile, found the backup session store file and use that to successfully restore my session. On this occasion however, this is not working.

What I'm trying to do now is to see if I can edit the recovery.bak file to try to get it working – e.g. find corruption and remove it. One thing I've noticed to start off with is that the count of "[" symbols is much higher than the count of "]" symbols – presumably they should be equal.

Is there anywhere I can find information on the format of this file? One thing I'm wondering is how it stores tab groups, so that I can isolate tabs from particular groups and remove them.

When I started Firefox it failed to restore my previous tabs and groups, and "Restore previous session" was greyed out. On previous occasions I have made a backup of my profile, found the backup session store file and use that to successfully restore my session. On this occasion however, this is not working. What I'm trying to do now is to see if I can edit the recovery.bak file to try to get it working – e.g. find corruption and remove it. One thing I've noticed to start off with is that the count of "[" symbols is much higher than the count of "]" symbols – presumably they should be equal. Is there anywhere I can find information on the format of this file? One thing I'm wondering is how it stores tab groups, so that I can isolate tabs from particular groups and remove them.

All Replies (7)

more options

Ignore the thing about the square brackets, it turns out I inadvertently introduced that while using find and replace to format the file to make it more readable.

more options

You can open the file in the Scratchpad (Firefox/Tools > Web Developer) and click the "Pretty Print" button to format the file for readability.

You can look at this post in this MozillaZine forum thread about inspecting a sessionstore file and possibly extract URLs.

A quick check for window 1 is this code in the Web Console (Firefox/Tools > Web Developer) with the sessionstore file in the current tab.

eval("ss = "+document.body.innerHTML.replace("<pre>","").replace("</pre>",""));
sd='';
for (var i = 0; i < ss.windows[0].tabs.length; i++) {
 var ent = ss.windows[0].tabs[i].entries;
 var last = ent[ent.length-1];
 sd+="<a href="+last.url+">"+last.url+"</a><br />";
}
document.body.innerHTML=sd;

Modified by cor-el

more options

Thank you - I was able to recover the list of URLs using the above advice.

I would still like to recover the tab groups if at all possible - I have 400 tabs and going through all of them to recreate the groups would take weeks given that I have a disability. I have done some experiments with editing the sessionstore file, including deleting all but one tab, and pasting tabs into a freshly created sessionstore.js, but each time Firefox ignores it and creates a new one in its place. In the second example, I also tried including the complete list of tab groups, which can be found by searching for "tabview-groups". I even tried removing the "extdata" table from a pasted tab (this doesn't exist in the default about:home tab). So by this point I'm pretty baffled as to why Firefox can't parse this file.

more options

I'm not using tab groups, so I don't know how they are stored in the sessionstore.js file.

If you were able to extract links from the sessionstore.js by processing the file as a JSON file file then I would assume that the file is OK and not corrupted. In that case it should work if you place the file as sessionstore.js in a Firefox profile folder. You can create a new profile to test this. If you haven't set to open the tabs and windows from the previous session then you need to got to "History > Restore Previous Session" and possibly use "History > Recently Closed Tabs/Windows" in addition.

Modified by cor-el

more options

I've worked out how to bring across individual tabs and tab groups, although it's not yet clear how feasible this will be for bringing across 400 tabs. I'll write instructions below for bringing across a single tab and its associated tab group, for those who are unfamiliar with the format.

First of all I've turned off syncing of tabs, and am working with a freshly generated sessionstore.js. To format both this file and the backed up file (recovery.bak) into a human readable format I'm now using the JSTool plug-in for Notepad++ (with the 'Newline before {' option set).

To bring across a tab, find its entry in the recovery file. For those reading this who haven't yet worked out the format, each tab starts with:

{
  entries" : [

Copy the entire entry from the { to the matching }. Paste it into the appropriate "tabs" list within the destination file – i.e. the tabs list within "windows", not under "_closedWindows" or suchlike.

The tab group is specified within the "extData" field in the entry – e.g.

"extData" : { "tabview-tab" : "{\"groupID\":2}" },

The ID number needs to match a tab within the list of tab groups – this can be found by searching for "tabview-groups". All the group data is embedded within a string so doesn't get nicely formatted, therefore it is very useful to use an editor (such as Notepad++) which highlights matching brackets. An individual tab group looks like this:

\"2\":{\"bounds\":{\"left\":15,\"top\":129,\"width\":821.077,\"height\":584},\"userSize\":null,\"title\":\"\",\"id\":2}

I assume the quoted ID at the start needs to match the "id" field at the end. It is probably also necessary to ensure that the fields for "tabview-groups" (nextID, activeGroupId and totalNumber) need to be edited appropriately.

I will carry on experimenting to see if I can bring across a greater bulk of tabs and groups.

more options

I forgot to mention, I have sometimes found that a tab won't appear unless its "tabview-tab" field has the "active" flag set, e.g.

"extData" : { "tabview-tab" : "{\"groupID\":2,\"active\":true}" },

more options

I have successfully copied across all tabs and groups. I didn't need to change any properties within the copied data. I still don't know why the original backup file doesn't work. Perhaps an error was introduced while editing it – one thing I remember doing is moving the tabs from "_closedWindows" to "windows". I will look into the available session manager extensions to protect against this in future.

As for why this happened in the first place, I remember loading up Firefox and seeing just two tabs – one was the standard Firefox start page, and the other was a welcome screen for the Dolphin Connect extension, which enables me to push tabs from my phone to Firefox. I don't know if this extension had anything to do with the failure to load the session (it had been installed for at least a week or two), but I have disabled it just in case.