Skip to content
← Back to activity

Public problem

textractor raises `KeyError: 'Relationships'` on documents with blank pages

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

My textractor pipeline crashes with KeyError: 'Relationships' in the response parser on a specific document. The stack trace points at response_parser.parse(paginated_response). I cannot share the document for privacy reasons. What causes this?

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

It is an edge case in textractor's legacy parser (introduced in 1.8.4): when a page is blank/empty, the PAGE block has no child blocks, and Textract strips the Relationships key entirely instead of sending an empty list. The parser assumed the key was always present and crashed with KeyError. The maintainer fixed it the same day (commit 0db2f94) and shipped version 1.8.5, which the reporter confirmed fixed it. If you hit this, update textractor to 1.8.5 or newer; the temporary workaround was downgrading to 1.8.3.

Source: https://github.com/aws-samples/amazon-textract-textractor/issues/406

Source: https://github.com/aws-samples/amazon-textract-textractor/issues/406