Fixing PaperlessNGX Email Processing Issues After Restart

When running PaperlessNGX in Docker, I encountered an issue where certain emails were not processed after restarting the Paperless container in the middle of a batch processing operation. Paperless saw the emails in the inbox but incorrect

ly marked them as already processed.

Identifying the Issue

The first step to diagnose the issue was to check the mail.log file within Paperless. The log provided information on which emails were skipped from processing, including their unique IDs. For example:

[2025-02-17 09:50:03,084] [DEBUG] [paperless_mail] Skipping mail '321' subject 'Email from Epson WF-4830 Series' from 'scanner@example.com', already processed.

Logging into the Database

To access the Paperless database running inside a Docker container, I used the following command:

docker compose exec db /bin/bash

This command opens a bash shell inside the db service container, allowing further interaction with PostgreSQL.

Resolving the Issue

To resolve the issue, I connected to the Paperless database, which was running on PostgreSQL. Using the provided email UID from the mail.log, I deleted the corresponding entries from the paperless_mail_processedmail table to allow Paperless to process the email again.

psql -U paperless_db_user

Here’s the SQL command I used:

DELETE FROM paperless_mail_processedmail WHERE uid = '322';

After running this command for every of the reported mails that are skipped, Paperless successfully reprocessed the emails during the next processing cycle.

Conclusion

If you encounter similar issues with PaperlessNGX not processing certain emails after a restart, checking the mail.log and manually deleting the processed mail entries from the database can be an effective solution.

#weeklyreview 25/24

herbal hike (?)

On Sunday we participated in the first herbal hike in our village. A local lady who’s quite knowledgeable about local herbs and their application for medical and cosmetic usage took a small group of people in a hike through the meadows and forest. She was showing us the various plants and explained how to identify them and what they might be used for. Quite interesting.

Cooking

Kiddo loves pasta. And she also loves cooking herself. So we went to make proper Spaghetti Carbonara. You don’t use cream! Just pancetta, egg yolk, grated pecorino cheese and a few spoons of the pasta water. That makes for a very creamy and rich carbonara.

Paperless Document Workflow improvements

I read an article about how to improve the document archiving process with PaperlessNGX. One basically wants some sort of clue between the paper document and the scanned digital copy. So that when you have either document, you can quickly find its counterpart. Paperless has a field for Archive Serial Number (ASN). You can sequentially number your documents if you want. Now you’d also want that serial number on the original paper document as a tie between the original and its digital copy. The trick is, to put a tiny sticker with a pre-generated ASN on the documents before scanning. Paperless can detect this ASN and use it as the serial number of the scanned document.

I was following the instructions in this article to enable the respective settings in my PaperlessNGX setup.

Paperless gets the ASN from QR codes. The stickers container QR codes and a text representation of the ASN for humans to read. The article also contains a link to a Python script which can generate sequential QR codes for various label papers.

I ordered the Avery Zweckform L4731 stickers which are 25,4mm x 10mm small. They fit on almost every document and are still readable. The trickiest part was to print them properly. The python generated labels didn’t seem to fit properly. The margins seems to be off at the top and bottom of the paper and thus the labels were overlapping the cut out stickers. I found out that one can also easily generate the stickers on the website of Avery Zweckform. They have an online editor for the labels which can generate sequential QR Codes and sequential text numbers. At the end you’ll get a PDF generated that you can print out. My print settings had to be A4 paper and explicitly set to scale 100% (not scale to fit or something else) on my Epson WF-4830. This gave me perfect printouts on the pre-cut sticker paper.

public dinner in the village

On Saturday it was finally time for our yearly public dinner in the village. We would gather at the patio in front of the church and dine together. Everyone brings their own food to be shared with other and table cloth and tableware.

This is always a lovely occasion to meet the neighbours, have good conversations and of course good food. It always amazes me that even without coordination there no duplication of food. People just get creative and bring their specialties.

and of course I got my nails done fancy by the kid 🙂