Skip to content

KeyError: 'container' Crash During Email Lookup After Successful Authentication #597

@swayamsopnic

Description

@swayamsopnic

Describe the bug

GHunt authenticates successfully and loads the stored session correctly, but crashes during the email lookup phase with a KeyError: 'container'.

The issue appears to originate from the People API response parsing logic in people.py, likely due to a schema change in Google's response structure.


To Reproduce

  1. Install GHunt 2.3.4
  2. Authenticate successfully using OAuth token
  3. Run:
ghunt email target@gmail.com
  1. Observe crash

Expected behavior

GHunt should complete the email lookup process without crashing, even if certain metadata fields are missing from the API response.

Ideally, missing fields should be handled gracefully using fallback checks instead of direct dictionary key access.


Actual Error

Traceback (most recent call last):
  File "/home/sopnic2/.local/bin/ghunt", line 6, in <module>
    sys.exit(main())
  ...
  File "/home/sopnic2/.local/share/pipx/venvs/ghunt/lib/python3.13/site-packages/ghunt/parsers/people.py", line 164, in _scrape
    self.coverPhotos[cover_photo_data["metadata"]["container"]] = person_cover_photo
KeyError: 'container'

System Information

  • OS: Arch Linux
  • Python Version: 3.13
  • GHunt Version: 2.3.4

Additional context

Authentication works correctly:

  • Stored session loads successfully
  • OAuth token is accepted
  • Google API requests appear to work

The crash only happens during parsing of People API response data.

Possible problematic line:

cover_photo_data["metadata"]["container"]

Suggested safer handling:

container = cover_photo_data.get("metadata", {}).get("container", "unknown")

This may be related to recent Google API response schema changes or incompatibility with Python 3.13.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions