Pazz mentioned a problem wrt reopening a notmuch database immediately after it has been closed. The problem can be reproduced with this test case: ~~~ snip ~~~ import os import notmuch db_path = os.path.expanduser('~/Maildir') for i in range(2): with notmuch.Database(db_path, mode=notmuch.Database.MODE.READ_WRITE) as db: query = db.create_query('tag:inbox AND NOT tag:killed') print(len(list(query.search_messages()))) ~~~ snap ~~~ Without this fix, the second loop iteration fails because the xapian lock is not released in time. Cheers, Justus