Mac OS X’s Mail: Problem with Envelope Index solved

Posted by Pierre Igot in: Mail
July 2nd, 2009 • 1:38 pm

This is a follow-up to my post earlier this morning about the problems I had this morning with trying to rebuild my “Envelope Index” file for Mail.

I have managed to solve the problem, with some prodding from a kind reader.

I carefully monitored the reimporting process (i.e. rebuilding of the “Envelope Index” file) and was able to notice that it would always crash when Mail reached a specific mailbox… the mailbox in which I archive my correspondence with my father, of all people.

I also noticed that both the system log and the crash log mentioned this:

Jun 29 09:47:14 Mac-Pro Mail[86791]: *** -[NSCFString stringByAppendingPathExtension:]: cannot append extension 'xls' to path ''
Jun 29 09:47:14 Mac-Pro Mail[86791]: Error: -[NSFileWrapper setPreferredFilename:] *** preferredFilename cannot be empty.

among other things… This led me to suspect that the mailbox with my dad’s archived messages contained a problem message that would cause this Mail crash every time.

I reopened Mail with the old “Envelope Index” file and went to check that particular mailbox. Again, I could see the list of messages, but when I tried to view any of them, I would get a blank window. I then tried to rebuild the mailbox (which, as indicated in the previous post, would normally fix this particular problem), and Mail crashed—with the same error messages in the crash log as above.

In other words, both the general reimport process and the simple mailbox rebuild process would cause Mail to crash when hitting that particular mailbox.

I then quit Mail, opened the “Mail” folder in my home library and located the mailbox folder for my dad’s correspondence. I manually removed it from its location and put it on the desktop.

I then relaunched Mail and tried to import that particular mailbox folder from its desktop location. I got the same crash again, but this time I could see that it was part way through the importing process, thereby confirming that it was occurring when Mail encountered a specific e-mail message.

I couldn’t tell which message from the Mail progress bar or the crash log, but given the mention of “xls” in the crash log, I started to suspect that it was an e-mail with Excel files attached to it. And sure enough, by sorting the e-mails by size in the Finder and using Quick Look to view the contents of the biggest ones, I was able to locate precisely one such message, with two Excel files in it:

Bad message

I proceeded to remove the offending message manually from the mailbox folder, and tried to reimport the mailbox folder without it. And it worked!

Finally, I quit Mail again, trashed the “Envelope Index” file again, and relaunched Mail, once again triggering the reimport process, but this time with my dad’s mailbox not containing the offending message.

And it worked! Mail managed to go through the entire process of importing over 100,000 messages without crashing.

So that is the solution of this particular mystery. Apparently, there was something in that message with the two Excel files attached that Mail really didn’t like.

I will send the offending e-mail with a bug report to Apple, and maybe they can figure out what causes the problem in this particular case (although I doubt that an isolated problem such as this one will register on their radar…).

I can’t help but find it a bit ironic that Microsoft files are able to give me grief even when I am not using Microsoft products. But that might be a bit unfair; it might just be a coincidence.

Still, it confirms me in my habit of removing attachments from e-mail messages before archiving them. I didn’t remove them in this particular case because it was a couple of files that my dad had asked me to hold on to for a while, until he was sure he had safe copies at home on his own system. At the time, I filed the message away with the attachments and then of course forgot about it. I guess I’ll have to try and be even more religious about removing attachments in the future.

(It also does not help that Mail’s “Remove Attachments” feature is still so badly flawed, which this stupid behaviour of deselecting the message after its attachment has been removed and selecting the next one in the list—or nothing if it’s the last one in the list. I am sure they consider this a “feature,” but I find it a royal pain to have to reselect the message after removing its attachments just to be able to file it away…)

Comments are closed.