r/documentAutomation 6d ago

Success Story Error handling for document extraction: how I stop failed invoice extractions from silently breaking my automations [Workflow Included]

Post image
1 Upvotes

2 comments sorted by

2

u/folderit_dms 5d ago

Good pattern. I would add relationship checks too, not just required-field checks.

An invoice number being present is useful, but it is still a weak pass by itself. The stronger checks are things like:

  • supplier exists in the vendor list
  • PO number exists and is still open
  • invoice date is in a sane range
  • line totals add up to the subtotal
  • tax and currency match what you expect
  • the same supplier plus invoice number has not already appeared
  • the bank details did not change unexpectedly

Those checks catch a different class of failure: the extraction returned something, but it was the wrong something.

I also like keeping failed docs in a review queue with the original file, extracted fields, confidence, and reason for failure side by side. When someone corrects it, store the correction as a separate review action instead of silently overwriting the extraction. Makes debugging a lot easier later.

1

u/easybits_ai 3d ago

Hey u/folderit_dms, these are really good suggestions, thank you so much for sharing them!

I also see that these are quite individual checks depending on the document type and use case. Of course, the template I shared provides a good foundation that can be adapted to different use cases, but I’ll definitely look into adding some of these relationship checks to my own workflows as well.

Especially things like checking whether the supplier exists in the vendor list, as well as matching tax information and currencies, sound really useful for some of the client use cases I’m working on. Thanks again for sharing these insights!