Skip to content

Fix KeyError when HuggingFace user profile fields are missing#20

Merged
p-e-w merged 1 commit intop-e-w:masterfrom
ricyoung:fix-optional-email-fields
Nov 19, 2025
Merged

Fix KeyError when HuggingFace user profile fields are missing#20
p-e-w merged 1 commit intop-e-w:masterfrom
ricyoung:fix-optional-email-fields

Conversation

@ricyoung
Copy link
Contributor

This PR fixes a bug where users without a public email or fullname set in their HuggingFace profile would encounter a KeyError during the model upload process.

Changes

  • Updated the HuggingFace login display to use .get() method with fallback values for optional profile fields (fullname and email)
  • Added graceful handling to prevent crashes when these fields are not available in the user profile

Testing

Tested with a HuggingFace account that has incomplete profile information.

Related

This resolves the issue where uploading models to HuggingFace would fail with a KeyError on the email or fullname field.

Handle optional fullname and email fields in user profile gracefully
using .get() method with fallback values to prevent KeyError when
uploading models to HuggingFace.

This fixes an issue where users without a public email or fullname
set in their HuggingFace profile would encounter an error during
the upload process.
@p-e-w p-e-w merged commit 13bb7b2 into p-e-w:master Nov 19, 2025
@p-e-w
Copy link
Owner

p-e-w commented Nov 19, 2025

Thanks! I didn't know it was possible for email not to be set. I don't think I was given that option when signing up.

But is it really possible for name not to be set? Every user has a username, no?

daggerstuff pushed a commit to daggerstuff/heretic that referenced this pull request Feb 22, 2026
Change requires-python to >=3.14.2
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.

2 participants