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.

ఇంకా తెలుసుకోండి

Thunderbird duplicates or marks messages as deleted when compacting folders

  • 11 ప్రత్యుత్తరాలు
  • 2 ఈ సమస్యలు కలిగి ఉన్నాయి
  • 5 వీక్షణలు
  • చివరి సమాధానమిచ్చినది Toad-Hall

more options

For the last few month I have a very strange problem.

Mozilla Thunderbird 52.6.0, and at least a couple of versions before that, occasionally but regularly duplicate or mark all messages in folders as deleted when compacting folders.

When all messages in a folder are duplicated, the mail file actually gets twice its usual filesize.

Through the Thunderbird add-on "Remove Duplicate Messages (Alternate)" (I don't have any other add-on installed) I can get rid of the duplicate messages.

When compacting folders after removing the duplicates this way, the mail file returns back to its usual size.

When I notice an empty folder, the actual filesize of the mail file hasn't changed and I can open the mail file in a text editor and subtract 8 from the last digit of the X-Mozilla-Status codes greater than or equal to 8 to restore all marked as deleted emails like this:

Change "X-Mozilla-Status: 0008" to "X-Mozilla-Status: 0000"

Change "X-Mozilla-Status: 0009" to "X-Mozilla-Status: 0001"

Change "X-Mozilla-Status: 000a" to "X-Mozilla-Status: 0002"

Change "X-Mozilla-Status: 000b" to "X-Mozilla-Status: 0003"

Change "X-Mozilla-Status: 000c" to "X-Mozilla-Status: 0004"

Change "X-Mozilla-Status: 000d" to "X-Mozilla-Status: 0005"

Change "X-Mozilla-Status: 000e" to "X-Mozilla-Status: 0006"

Change "X-Mozilla-Status: 000f" to "X-Mozilla-Status: 0007"

Change "X-Mozilla-Status: 0018" to "X-Mozilla-Status: 0010"

Change "X-Mozilla-Status: 0019" to "X-Mozilla-Status: 0011"

Change "X-Mozilla-Status: 001a" to "X-Mozilla-Status: 0012"

Change "X-Mozilla-Status: 001b" to "X-Mozilla-Status: 0013"

Change "X-Mozilla-Status: 001c" to "X-Mozilla-Status: 0014"

Change "X-Mozilla-Status: 001d" to "X-Mozilla-Status: 0015"

Change "X-Mozilla-Status: 001e" to "X-Mozilla-Status: 0016"

Change "X-Mozilla-Status: 001f" to "X-Mozilla-Status: 0017"

Change "X-Mozilla-Status: 1008" to "X-Mozilla-Status: 1000"

Change "X-Mozilla-Status: 1009" to "X-Mozilla-Status: 1001"

Change "X-Mozilla-Status: 100a" to "X-Mozilla-Status: 1002"

Change "X-Mozilla-Status: 100b" to "X-Mozilla-Status: 1003"

Change "X-Mozilla-Status: 100c" to "X-Mozilla-Status: 1004"

Change "X-Mozilla-Status: 100d" to "X-Mozilla-Status: 1005"

Change "X-Mozilla-Status: 100e" to "X-Mozilla-Status: 1006"

Change "X-Mozilla-Status: 100f" to "X-Mozilla-Status: 1007"

Change "X-Mozilla-Status: 1018" to "X-Mozilla-Status: 1010"

Change "X-Mozilla-Status: 1019" to "X-Mozilla-Status: 1011"

Change "X-Mozilla-Status: 101a" to "X-Mozilla-Status: 1012"

Change "X-Mozilla-Status: 101b" to "X-Mozilla-Status: 1013"

Change "X-Mozilla-Status: 101c" to "X-Mozilla-Status: 1014"

Change "X-Mozilla-Status: 101d" to "X-Mozilla-Status: 1015"

Change "X-Mozilla-Status: 101e" to "X-Mozilla-Status: 1016"

Change "X-Mozilla-Status: 101f" to "X-Mozilla-Status: 1017"

But when I compact folders twice and don't notice the empty folder before the second time the folders are compacted, then all emails in the entire folder are actually removed, since the mail file then gets emptied (0 bytes), because compacting folders removes all emails which compacting folders had marked as deleted the previous time.

Why does Thunderbird occasionally duplicate or mark all messages in a folder as deleted when compacting folders, and how can this be prevented?

For the last few month I have a very strange problem. Mozilla Thunderbird 52.6.0, and at least a couple of versions before that, occasionally but regularly duplicate or mark all messages in folders as deleted when compacting folders. When all messages in a folder are duplicated, the mail file actually gets twice its usual filesize. Through the Thunderbird add-on "Remove Duplicate Messages (Alternate)" (I don't have any other add-on installed) I can get rid of the duplicate messages. When compacting folders after removing the duplicates this way, the mail file returns back to its usual size. When I notice an empty folder, the actual filesize of the mail file hasn't changed and I can open the mail file in a text editor and subtract 8 from the last digit of the X-Mozilla-Status codes greater than or equal to 8 to restore all marked as deleted emails like this: Change "X-Mozilla-Status: 0008" to "X-Mozilla-Status: 0000" Change "X-Mozilla-Status: 0009" to "X-Mozilla-Status: 0001" Change "X-Mozilla-Status: 000a" to "X-Mozilla-Status: 0002" Change "X-Mozilla-Status: 000b" to "X-Mozilla-Status: 0003" Change "X-Mozilla-Status: 000c" to "X-Mozilla-Status: 0004" Change "X-Mozilla-Status: 000d" to "X-Mozilla-Status: 0005" Change "X-Mozilla-Status: 000e" to "X-Mozilla-Status: 0006" Change "X-Mozilla-Status: 000f" to "X-Mozilla-Status: 0007" Change "X-Mozilla-Status: 0018" to "X-Mozilla-Status: 0010" Change "X-Mozilla-Status: 0019" to "X-Mozilla-Status: 0011" Change "X-Mozilla-Status: 001a" to "X-Mozilla-Status: 0012" Change "X-Mozilla-Status: 001b" to "X-Mozilla-Status: 0013" Change "X-Mozilla-Status: 001c" to "X-Mozilla-Status: 0014" Change "X-Mozilla-Status: 001d" to "X-Mozilla-Status: 0015" Change "X-Mozilla-Status: 001e" to "X-Mozilla-Status: 0016" Change "X-Mozilla-Status: 001f" to "X-Mozilla-Status: 0017" Change "X-Mozilla-Status: 1008" to "X-Mozilla-Status: 1000" Change "X-Mozilla-Status: 1009" to "X-Mozilla-Status: 1001" Change "X-Mozilla-Status: 100a" to "X-Mozilla-Status: 1002" Change "X-Mozilla-Status: 100b" to "X-Mozilla-Status: 1003" Change "X-Mozilla-Status: 100c" to "X-Mozilla-Status: 1004" Change "X-Mozilla-Status: 100d" to "X-Mozilla-Status: 1005" Change "X-Mozilla-Status: 100e" to "X-Mozilla-Status: 1006" Change "X-Mozilla-Status: 100f" to "X-Mozilla-Status: 1007" Change "X-Mozilla-Status: 1018" to "X-Mozilla-Status: 1010" Change "X-Mozilla-Status: 1019" to "X-Mozilla-Status: 1011" Change "X-Mozilla-Status: 101a" to "X-Mozilla-Status: 1012" Change "X-Mozilla-Status: 101b" to "X-Mozilla-Status: 1013" Change "X-Mozilla-Status: 101c" to "X-Mozilla-Status: 1014" Change "X-Mozilla-Status: 101d" to "X-Mozilla-Status: 1015" Change "X-Mozilla-Status: 101e" to "X-Mozilla-Status: 1016" Change "X-Mozilla-Status: 101f" to "X-Mozilla-Status: 1017" But when I compact folders twice and don't notice the empty folder before the second time the folders are compacted, then all emails in the entire folder are actually removed, since the mail file then gets emptied (0 bytes), because compacting folders removes all emails which compacting folders had marked as deleted the previous time. Why does Thunderbird occasionally duplicate or mark all messages in a folder as deleted when compacting folders, and how can this be prevented?

న Mosu చే మార్చబడినది

ప్రత్యుత్తరాలన్నీ (11)

more options

Compacting does not 'mark all messages as deleted'. Compacting removes all messages that are 'marked as deleted'.

mbox files contains emails that are written to the file one after the other in the order downloaded.

If a file gets corrupted or damaged before compacting, Thunderbird could start to lose track of where each message begins and ends, so it may know where the first message is marked as deleted, but it may not know where it ends. Hence a loss of emails.

If anything weird starts to occur in a Folder Pane folder, then it is advised to assume some corruption of the file may have occurred and do not compact that folder until all emails have been secured in another folder.

At this point create a new suitable folder.

  • Move all good emails from corrupted folder into new folder.
  • Delete anything you do not want.

When the corrupted folder is empty:

  • Right click on folder and select 'Compact'

This should completely empty that file in the profile folder.

Some causes of file corruption : Not compacting on a frequent basis (daily if you delete a lot of emails). Improper management eg: allowing mbox file to get too large. Anti-Virus products attempting to 'fix' folders. Bad headers. Issue with where file is stored on hardrive. computer crash whilst files were open. A virus attach.

It may be possible that the relevant index file (.msf) gets out of synch and may be showing emails already deleted, so they may appear to downloaded again or get resurrected. Repairing an index file can sometimes resolve an issue, if emails disappear after repairing then they were not in the mbox file in the first place; they had been deleted previously.

Sometimes an AV product may have attempted to fix an mbox file, but it has no knowledge of the index file, so emails still appear to be there but in reality they may already have been lost as the attempted fix could have quarrantined the mbox file.

Advise you read this info:

న Toad-Hall చే మార్చబడినది

more options

Compacting should only remove all messages that are 'marked as deleted' by the user.

But besides that, the problem is that compacting does regularly duplicate all messages in a folder or mark all messages in a folder as deleted, and the second run actually deletes all messages in the folder.

As far as I can see the files do not get corrupted or damaged. No virus or scanner does anything with the files.

The headers are fine except for the X-Mozilla-Status when all messages got marked as deleted.

The index files (.msf) are not out of sync.

Compacting empty folders results in 0 bytes mbox files as expected.

Removing the index file of a folder after the problem occurs and changing the X-Mozilla-Status by subtracting 8 from the last digit of the X-Mozilla-Status restores the emails. But this only works when the emptied folder is noticed before running compact folders a second time, otherwise all emails in the folder are lost, as the second compact folders run creates a 0 bytes mbox file.

The problem also occurs in very small and brand new folders.

more options

re :Compacting should only remove all messages that are 'marked as deleted' by the user. That is correct. But if the file gets corrupted then it is not known where the 'marked as deleted' part ends, hence all emails can be lost.

But....if something else is marking all emails as deleted, (Compacting does not mark messages as deleted) then....

re :When I notice an empty folder, the actual filesize of the mail file hasn't changed This is because the emails have been 'marked as deleted' and are hidden from view, but at this point can be rescued as you describe because no compacting has as yet occurred.

So it would appear something is marking those emails as deleted.

Q: Are we talking about 'pop' or 'imap' mail account folders.

Q: Do you access that email address via another device eg: phone, webmail, another computer?

Q: Are the folders in 'Local Folders' mail account?

Q: Are you talking about the 'Junk' folder (or Spam if imap)


  • Right click on mail account in Folder pane and select: 'Settings'

for POP:

  • select 'Disc Space'

for IMAP:

  • select 'Synchronisation & Storage'
  • select 'Don't delete any messages'
  • click on 'OK'

Check the folders in Folder Pane:

  • right click on folder and select 'Properties'
  • select 'Retention Policy' tab
  • select: 'Use my account settings.
  • click on 'OK'

Please confirm you have checked the Account Settings. Please confirm you have checked the folders Retention Policy settings.

more options

The bit that is puzzling is the 'Duplicates'. re :When all messages in a folder are duplicated,

This sounds like you may be using pop mail account. Pop mail accounts keep a record of what has been downloaded in the 'popstate.dat' file.

If that file has been removed then Thunderbird has no knowledge of what has been downloaded and so will download again. So therefore I ask... Do you have a product like CCleaner performing cleaning up temp files etc on your computer? If yes, you must make sure CCLeaner does not have any access to any Thunderbird folder or file.

Please confirm you do not have any cleanup type of program running and that can also include some Anti-Virus programs with cleanup/ performance tools. Or if running you must make sure all Thunderbird files and folders are excluded.

more options

If you get a folder that suddenly has duplicates: Obviously, you may need to wait and see if this occurs again first :)

  • right click on folder and select 'Properties'
  • click on 'Repair Folder' button
  • click on 'OK'

select another folder and reselect 'fixed' folder. Do the duplicates disappear or not?

more options

Q: Are we talking about 'pop' or 'imap' mail account folders. A: POP.

Q: Do you access that email address via another device eg: phone, webmail, another computer? A: Only on two computers with the same most recent Windows 10 and Thunderbird versions.

Q: Are the folders in 'Local Folders' mail account? A: No, in the folders of the POP mail account.

Q: Are you talking about the 'Junk' folder (or Spam if imap) A: No, the problem occurs in subfolders of Inbox.

The Account Settings are correct (' Don't delete any messages '). The folders Retention Policy settings are correct (' Use my account settings ').

I compact on a frequent basis and don't delete or move a lot of emails. I keep the mbox files small, the problem also occurs with very small mbox files of less that 1 MB. All email related functionality of ESET Internet Security has been disabled. The emails have proper headers. The SSD on which the files are located is fine. The problem occurs without any crash at all. ESET Internet Security does not detect any virus.

The relevant index files (.msf) don't get out of sync. Repairing/removing the index file does not resolve the issue. The problem that Thunderbird shows emails that are already deleted never occurs. Thunderbird displays messages that - for an unknown reason - are marked as deleted or have been duplicated in the mbox file as such. So the problem is that the messages are marked as deleted or are being duplicated in the mbox file.

The problem has nothing to do with the 'popstate.dat' file, no mail gets redownloaded, also all email is removed from the server after downloading, and even if it wasn't it would download email again to the inbox, displaying those emails as unread emails, and not cause the duplication of all (old and marked as read) emails in certain subfolders.

I don't use CCleaner or similar software.

The 'Repair Folder' button changes nothing, the duplicates remain.

more options

re : Q: Do you access that email address via another device eg: phone, webmail, another computer? A: Only on two computers with the same most recent Windows 10 and Thunderbird versions. also all email is removed from the server after downloading,

POP accounts: If you are downloading to two computers, usually email is left on server by both computers so the second computer can access the same emails. Are you saying that one computer downloads and leaves on server - so you always have to download to this computer first, then the second one downloads and deletes off server and it is the second computer which is having the issue? OR do you have different emails on different computers because each computer accesses server, downloads and deletes off server? So neither computer has a copy of what is on the other for the same email address.

I'm trying to understand how you are using pop on both accounts so understanding how the downloading is working.

re :I compact on a frequent basis and don't delete or move a lot of emails. You mention that you "don't delete or move a lot " of emails. If you are not deleteing emails from a specific folder then you do not need to compact that folder.

Help me to understand what process you are using. You mention "I compact on a frequent basis", so I presume you only compact after deleting just a few emails? Are you only compacting a selected folder - the one from which you had deleted some emails? eg: Right click on folder and select 'Compact' Or are you using this method: 'Menu icon' > 'File' > 'Compact folders'

I would expect you empty junk folders and then compact junk folders?

re :it would download email again to the inbox, displaying those emails as unread emails Agree - newly downloaded emails would appear in Inbox; unless a Message Filter moved them.

If definately not downloading again, then it would seem you have corrupted files.

Whilst trying to work out what is the cause, I would suggest: Create new folders - not subfolders of Inbox. They are to be used to store what is currently in the 'Inbox' and all emails currently in subfolders of Inbox. Move all good emails from those Inbox subfolders into the new folders. Move good emails from Inbox to a new folder. Delete any emails you do not want from Inbox and it's subfolders. Then compact Inbox and each of the Inbox subfolders. Do this compacting on the specific folder.

This should do a complete cleanup of those folders without losing any good emails. You may want to delete the Inbox subfolders and continue using the new folders.

more options

I'm not downloading email to two computers, I'm using one single Thunderbird profile on two computers, on the first computer directly and on the second computer through a network share of the first computer.

Up to now I've always used 'Menu icon' > 'File' > 'Compact folders'. But given this problem, your selective compacting suggestion to right click on a certain folder and select 'Compact' to only compact that folder is better, so I can see the problem occuring and fix it immediately.

న Mosu చే మార్చబడినది

more options

re :select 'Compact' to only compress that folder

As you used the words 'compress' and 'compressing', I'm a bit concerned that you do not understand or I have not made it clear what 'Compact Folder' actually does. Please note that 'compacting' is not 'compressing'. They are not the same thing; nothing is compressed.

When an email arrives it is written to the document; an mbox text file. When a second email arrives it is written in the same document, below the first one. A third email is written below the second email and so on. Imagine, you decide that the second email is not required, so you press 'Delete' to remove it. A marker is set against that email saying this email is 'marked for deletion', that marker hides that email from view in the email list, but does not actually remove it from the file. When you select 'Compact folder', the file is checked and when the 'marked for deletion' email is found, it is removed, so a section (that email) is removed from the document, the file is saved and is now a bit smaller and more tidy.

Compression is entirely different, with compression nothing is deleted, nothing is removed. 'Compressing', also called 'zipping' only changes how data is stored; compacting changes the actual data.

So you only need to use 'Compact Folder' if you have deleted emails from that folder.

more options

I know what compacting is supposed to do, but the problem is that it doesn't always do so.

Let's take your example with three emails in a folder

[mbox file] email 1 with content A email 2 with content B email 3 with content C [ /mbox file]

in which you delete the second email

[mbox file] email 1 with content A email 2 with content B (with X-Mozilla-Status marked for deletion) email 3 with content C [ /mbox file]

Compacting this folder should result in

[mbox file] email 1 with content A email 2 with content C [ /mbox file]

but instead it sometimes results in

[mbox file] email 1 with content A email 2 with content C email 3 with content A email 4 with content C [ /mbox file]

Through the Thunderbird add-on "Remove Duplicate Messages (Alternate)" I can get rid of the duplicate messages, but when I compact that folder again afterwards it results in an empty (0 bytes) file

[mbox file] [ /mbox file]

so all emails are lost.

న Mosu చే మార్చబడినది

more options

The compacting process copies non-deleted messages to a temporary nstmp file which will be created in the same location as the mbox file and then assuming that is successful, the original file is emptied. Thunderbird then copies the contents of the nstmp file back into the original folder and finally deletes the temporary nstmp file.

If something interrupts the process then usually the nstmp file is not copied back and remains visible. It can show up as a folder in the Folder Pane. Can you confirm you do not have any nstmp files in profile or showing up in Folder Pane?


In your case it would seem to be copying back the contents, but not clearing the original contents before hand, hence you see 'duplicates'. But the duplicates will be identical in every way, not just content.

I'm interested in the fact that your computer 'B' is accessing the same profile stored on computer 'A' via Network share.

On computer 'A' is the thunderbird profile in the default position?

  • eg: C:\Users\<Windows user name>\AppData\Roaming\Thunderbird\Profiles\<Profile name>\

If no, please state where you have put the profile.

Test: Assuming the following:

  • Computer 'B' is not booted up - it is shut down, so no chance of file share can occur via network.

On computer 'A', which has the profile allow some emails to come into Inbox even if it means sending some to yourself. Delete unwanted emails. Leave a couple of emails in Inbox. Compact Inbox.

Please post results of compacting to remove marked as deleted emails on computer 'A' whilst computer 'B' is completely shut down.