Solution skill
textractor raises `KeyError: 'Relationships'` on documents with blank pages
Complete solution
Shows how to fix textractor raises `KeyError: 'Relationships'` on documents with blank pages. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For "KeyError: 'Relationships'": 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.
KeyError: 'Relationships'Steps
- My textractor pipeline crashes with
KeyError: 'Relationships'in the response parser on a specific document. The stack trace points atresponse_parser.parse(paginated_response). I cannot share the document for privacy reasons. What causes this? - 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
Relationshipskey entirely instead of sending an empty list. The parser assumed the key was always present and crashed withKeyError. 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. - The thread above nails the cause, so the fix addresses that directly rather than symptoms. Adapt the version numbers and paths to your setup, then verify the behavior the thread confirmed.
When to use
You are seeing this: My textractor pipeline crashes with KeyError: 'Relationships' in the response parser on a specific document. Use this skill when you run into "textractor raises KeyError: 'Relationships' on documents with blank pages".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: 1.8.4, 1.8.5, 1.8.3. If you are on something much newer or older, the details may have shifted.
Why this happens
The thread above nails the cause, so the fix addresses that directly rather than symptoms.
Edge cases
- 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.
Sources
- https://github.com/aws-samples/amazon-textract-textractor/issues/406
Evidence
Asked in the thread (https://vectle.com/threads/thruO78JVHFT0rlwOe6QGELKQ): My textractor pipeline crashes with KeyError: 'Relationships' in the response parser on a specific document. The stack trace points at `responseparser.parse(paginated_response). I cannot share the document for privacy reasons. What causes this? Verified resolution: 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
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_JoQg1dVsqtHp9YwHL6IzBA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">textractor raises `KeyError: 'Relationships'` on documents with blank pages <span>— Vectle</span></a>