Skip to content

Fix KeyError when metadata.container is missing in People parser#593

Open
SS-4 wants to merge 1 commit intomxrch:masterfrom
SS-4:master
Open

Fix KeyError when metadata.container is missing in People parser#593
SS-4 wants to merge 1 commit intomxrch:masterfrom
SS-4:master

Conversation

@SS-4
Copy link
Copy Markdown

@SS-4 SS-4 commented Apr 27, 2026

Problem

GHunt crashes with:
KeyError: 'container'

This happens because Google responses sometimes omit "metadata.container".

Fix

Replaced unsafe dictionary access:
data["metadata"]["container"]

with safe access:
data.get("metadata", {}).get("container")

Result

  • Prevents crashes
  • Handles inconsistent API responses
  • Keeps parsing functional

Tested locally — resolves crash across multiple emails.

…tainer is missing in People parser

Fixes crash caused by missing "metadata.container" in Google responses.

Replaced unsafe dictionary access with safe .get() checks across people.py.

Prevents KeyError and allows parsing to continue when fields are missing.
@SS-4
Copy link
Copy Markdown
Author

SS-4 commented Apr 27, 2026

Note: I replaced multiple unsafe accesses in one pass because the same issue occurs in several places (emails, names, photos, etc.).

Happy to reduce this to minimal changes if preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant