Al Haji-Ali writes: > I changed the message, removed "B" from "References" and deleted the > files of all old (and intermediate) drafts that have "B" in > "References". But no matter what I do, I have "B" grouped with "D" > and any other messages which I create with "In-Reply-To" being "A". How did you find the files to delete? One trap to watch out for is that if using notmuch, you should use notmuch search --exlude=false, to make sure messages are not being hidden because of their tags. > I suspect that somewhere in the database the IDs of "A" and "B" are > linked now. Is there a way (short of deleting the database and > re-indexing) to correct this and remove this connection? The database does not store relationships explicitely, only via messages with references to other messages. At a high level you can try the attached script to get a picture of the corresponding thread. If you can't run the script, or it doesn't help, you can interrogate the database directly without going through notmuch. if the message-id of B is 'foo@example.org' you can search with for replies with xapian-delve (in xapian-tools on Debian and derivatives). xapian-delve -d .local/share/notmuch/default/xapian \ -t 'XREPLYTOfoo@example.org' and for references xapian-delve -d .local/share/notmuch/default/xapian \ -t 'XREFERENCEfoo@example.org' That will give you Xapian record numbers, and you can turn those into files with something like xapian-delve -d .local/share/notmuch/default/xapian -r 801793 -1 | \ perl -ne 's/XF(D|O).*?:// && print' For records with multiple files, you will have to figure out with file goes with which directory (or just find the file names, which supposed ot be unique).