Re: Database error

Subject: Re: Database error

Date: Fri, 20 Apr 2018 09:44:25 -0300

To: Varac, Notmuch Mail


From: David Bremner

Varac <> writes:

> Hi,
> I get a DatabaseError right after initial indexing.
> I can reproduce this with my mails every time.
> First, I remove the whole .notmuch/xapian directory and
> run "notmuch new", which results in a DatabaseError when
> using "xapian-check":
>   » notmuch new
>   Welcome to a new version of notmuch! Your database will now be upgraded.
>   This process is safe to interrupt.
>   Backing up tags to /home/varac/.offlineimap/Mail/.notmuch/dump-20180419T160138.gz...
>   Your notmuch database has now been upgraded.
>   Processed 148440 total files in 13m 38s (181 files/sec.).
>   Added 140351 new messages to the database.
>   » xapian-check .notmuch/xapian 
>   docdata:
>   blocksize=8K items=564 firstunused=7 revision=7 levels=1 root=2
>   B-tree checked okay
>   docdata table structure checked OK
>   termlist:
>   blocksize=8K items=305882 firstunused=64506 revision=7 levels=2 root=63491
>   xapian-check: DatabaseError: 1 unused block(s) missing from the free list, first is 0

This is almost certainly a known and recently fixed xapian bug. notmuch
compact is the recommended workaround (or just ignore the message).

> After this I try to tun "afew --tag --new -v" but it fails with (I don't know if 
> this is related though):
>   Traceback (most recent call last):
>     File "/usr/bin/afew", line 11, in <module>
>       load_entry_point('afew==1.3.0', 'console_scripts', 'afew')()
>     File "/usr/lib/python3/dist-packages/afew/", line 159, in main
>       inner_main(args, database, query_string)
>     File "/usr/lib/python3/dist-packages/afew/", line 23, in main
>     File "/usr/lib/python3/dist-packages/afew/filters/", line 59, in run
>       for message in self.database.get_messages(query):
>     File "/usr/lib/python3/dist-packages/afew/", line 93, in get_messages
>       for message in self.do_query(query).search_messages():
>     File "/usr/lib/python3/dist-packages/notmuch/", line 182, in search_messages
>       raise NotmuchError(status)
>   notmuch.errors.XapianError

It's hard to say for sure, but it's possible this would be fixed by the

That should be part of a bug-fix release of notmuch fairly soon. You can
also try to find a subset of mail reproducing the problem. I don't
know what that afew invokation is trying to do. Can you reproduce the
problem using the notmuch CLI?

notmuch mailing list