Hi Austin, when I switched to using your custom query parser I started experiencing "Unable to get write lock" errors when I run my initial tagging script. I thought that this was because I run the script while processing the mail in Emacs, but today I realized that this happens even without Emacs and that it can be reproduced by a simple command below. i=0; while notmuch tag +xxx tag:whatever; do i=$((i+1)); echo $i; done It seems that sometimes the unlocking of the Xapian database happens somewhat lazily and when the subsequent command starts I get: A Xapian exception occurred opening database: Unable to get write lock on /home/wsh/mail/.notmuch/xapian: already locked This happens almost regularly after a few iterations of the loop even if the query doesn't match anything. Do you have an idea what may cause this? Can you reproduce this on your system? The version I use can be obtained from git://rtime.felk.cvut.cz/notmuch.git custom-query-pasrser Thanks -Michal