FWIW, here's the patch I ended up using to play with this: diff --git a/mutt_notmuch.c b/mutt_notmuch.c index 2f21407..a07b1ba 100644 --- a/mutt_notmuch.c +++ b/mutt_notmuch.c @@ -636,11 +636,15 @@ char *nm_uri_from_query(CONTEXT *ctx, char *buf, size_t bufsz) static notmuch_message_t *get_nm_message(notmuch_database_t *db, HEADER *hdr) { notmuch_message_t *msg; + notmuch_status_t r; + char *id = nm_header_get_id(hdr); dprint(2, (debugfile, "nm: find message (%s)\n", id)); - msg = id && db ? notmuch_database_find_message(db, id) : NULL; + if (id && db) { + r = notmuch_database_find_message(db, id, &msg); + } FREE(&id); return msg;