MacOS – Phantom unread message in Mail.app

macosmail.app

I have a smart mailbox with only one rule: messages that are unread.
Right now I have no unread messages in any of my acccounts, yet the smart mailbox shows a counter of 1.
Opening the smart mailbox shows no messages (this is correct). If a new message arrives, the counter goes up to 2, then as soon as I read that message it goes back to 1.
I tried:

  • Rebuilding my inboxes
  • Rebuilding my smart mailbox. Logs this error:

27/10/13 11:42:18,753 Mail[16057]: * Assertion failure in
+[MFLibrary mailboxIDForMailbox:loadIfNotPresent:], /SourceCache/Mail/Mail-1816/FrameworkTargets/MailFramework/Library/MFLibrary.m:9814
Called on smart mailbox Unread ( 0 MailCore
0x00007fff8c6ecc8c -[MCAssertionHandler
_handleFailureWithPreamble:description:arguments:] + 141 1 MailCore 0x00007fff8c6ecafd -[MCAssertionHandler
handleFailureInMethod:object:file:lineNumber:description:] + 215 2
Mail 0x00007fff8cdf105d +[MFLibrary
mailboxIDForMailbox:loadIfNotPresent:] + 170 3 Mail
0x00007fff8ce0ea24 -[MFLibraryStore
rebuildTableOfContentsSynchronously] + 533 4 CoreFoundation 0x00007fff921f3dec invoking + 140 5 CoreFoundation
0x00007fff921f3c54 -[NSInvocation invoke] + 308 6 MailCore
0x00007fff8c73db74 -[MCMonitoredInvocation invoke] + 211 7 MailCore
0x00007fff8c760808 -[MCThrowingInvocationOperation main] + 40 8
MailCore 0x00007fff8c704f08
-[MCInvocationOperation main] + 332 9 Foundation 0x00007fff86da9591 -[_NSOperationInternal _start:] + 631 10
Foundation 0x00007fff86da923b
__NSOQSchedule_f + 64 11 libdispatch.dylib 0x00007fff8f3212ad _dispatch_client_callout + 8 12 libdispatch.dylib
0x00007fff8f3257ff _dispatch_async_redirect_invoke + 154 13
libdispatch.dylib 0x00007fff8f3212ad
_dispatch_client_callout + 8 14 libdispatch.dylib 0x00007fff8f32309e _dispatch_root_queue_drain + 326 15
libdispatch.dylib 0x00007fff8f324193
_dispatch_worker_thread2 + 40 16 libsystem_pthread.dylib 0x00007fff8c3dfef8 _pthread_wqthread + 314 17
libsystem_pthread.dylib 0x00007fff8c3e2fb9 start_wqthread
+ 13 )

  • Deleting and recreating my smart mailbox
  • Adding a rule restricting the smart mailbox to one account (if the rule is added, it works correctly)
  • Relaunching mail, rebooting
  • Looking in the logs. Only line from mail: 27/10/13 11:38:19,956 Mail[1174]: View Based NSTableView error: preparedCellAtColumn:row: was called. Please log a bug with the backtrace from this log, or stop using the method. 

I'm kinda out of ideas. Is there anything else I can try, any debug info I can access?

Best Answer

I fixed this for my smart mailboxes (Mail.app v7.0 1822) by following these steps:

  1. Open a terminal
  2. Re-index Spotlight

    sudo mdutil -E /

I suspect this is related to Mavericks improvements in Spotlight, as it now indexes Mail.app messages much better than in previous releases.