Notmuch and cross-posts, is my database corrupted?

Subject: Notmuch and cross-posts, is my database corrupted?

Date: Thu, 27 Aug 2026 11:47:46 -0400

To: notmuch@notmuchmail.org

Cc:

From: Gabriel Krisman Bertazi


Hello,

I'm hitting an issue with notmuch-emacs where if I search an email in a
specific folder with tag:unread it doesn't show, but if I search without
the tag:unread, notmuch finds it and says it has tag:unread.

I removed emacs from the equation and tracked to notmuch:

$ notmuch search 'thread:000000000001f39c AND folder:suse/INBOX'
thread:000000000001f39c    August 07 [1/456(913)] Greg Kroah-Hartman| Joshua Peisach, Ronald Warsow, Pavel Machek, Shuah Khan, Thorsten Leemhuis, Brett A C Sheffield, Takeshi Ogasawara, Benjamin Boortz, Justin Forbes, Peter Schneider, Markus Reichelt, Ron Economos, Barry K. Nathan, Miguel Ojeda, Jeffrin Thalakkottoor, Mark Brown; [PATCH 7.1 293/438] io_uring/net: initialize mshot_len for send (patch signed unread)

You can see it has tag:unread.  But if I add "AND tag:unread" to my search:

$ notmuch search 'thread:000000000001f39c AND folder:suse/INBOX AND tag:unread'
//no result

In addition:

$ notmuch search --output tags 'thread:000000000001f39c AND folder:suse/INBOX'
patch

After some debugging, I found the reason is that this message was
cross-posted, and exists from multiple sources:

$ notmuch search  --output files 'thread:000000000001f39c AND folder:suse/INBOX'
/home/krisman/Maildir/lei/linux-fsdevel/cur/1f8e2d206fa939895a9c865a9cad26fdda96431f:2,S
/home/krisman/Maildir/suse/INBOX/cur/1786117413.2069216_1.cartola,U=18382:2,S
/home/krisman/Maildir/lei/INBOX/cur/1f8e2d206fa939895a9c865a9cad26fdda96431f:2,S

They seem to be at least two different objects in the database:

$ notmuch search  --output tags 'thread:000000000001f39c AND folder:lei/linux-fsdevel'
patch
signed
unread
$ notmuch search  --output tags 'thread:000000000001f39c AND folder:lei/INBOX'
patch
signed
unread
$ notmuch search  --output tags 'thread:000000000001f39c AND folder:suse/INBOX'
patch

So, the tags are out of sync across the cross-posts.  Is this expected?
When I set a tag via notmuch-emacs (with +unread), should it update all
versions of the message?

In addition, The following commands seem inconsistent with each other.
Either they both should find the INBOX copy of the message and report
only the "patch" tag, or they should find the multiple objects and both
report the 3 tags, IMO.


$ notmuch search 'thread:000000000001f39c AND folder:suse/INBOX'
thread:000000000001f39c    August 07 [1/456(913)] Greg Kroah-Hartman| Joshua Peisach, Ronald Warsow, Pavel Machek, Shuah Khan, Thorsten Leemhuis, Brett A C Sheffield, Takeshi Ogasawara, Benjamin Boortz, Justin Forbes, Peter Schneider, Markus Reichelt, Ron Economos, Barry K. Nathan, Miguel Ojeda, Jeffrin Thalakkottoor, Mark Brown; [PATCH 7.1 293/438] io_uring/net: initialize mshot_len for send (patch signed unread)

$ notmuch search --output tags 'thread:000000000001f39c AND folder:suse/INBOX'
patch

In short, I could use some assistance in understanding how people deal
with cross-posts, and whether this behavior is expected or if my
database ended up somehow corrupted.  If that is the case, what is the
process to regenerate it?

-- 
Gabriel Krisman Bertazi
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: