Skip to content

Fix 8 high-volume Sentry production errors (~30K events/day)#3199

Draft
cursor[bot] wants to merge 2 commits intomainfrom
cursor/sentry-error-investigation-dbe1
Draft

Fix 8 high-volume Sentry production errors (~30K events/day)#3199
cursor[bot] wants to merge 2 commits intomainfrom
cursor/sentry-error-investigation-dbe1

Conversation

@cursor
Copy link
Copy Markdown

@cursor cursor Bot commented Mar 17, 2026

Addresses 8 recurring Sentry errors with a combined ~30K events/day through minimal, safe defensive fixes:

Fixes:

  • 4KKR (14K events): ResearchhubUnifiedDocument.DoesNotExist in Personalize sync — guard with try/except
  • 4KQQ (3.1K events): Hub.MultipleObjectsReturned in get_from_subfield — use filter().first() instead of get()
  • 4KTW (2.8K events): Paper.DoesNotExist in feed entry creation — catch missing items gracefully
  • 4JW1/4JW2/4JW3 (8.4K events): GitHub 422 Unprocessable Entity — treat as permanent skip, not error
  • 4MFH (1K events): Paper-not-found log noise in enrichment tasks — downgrade logger.error to logger.warning
  • 4M79 (640 events): User has no author_profile — catch RelatedObjectDoesNotExist before logging to Sentry
  • 4KXM (188 events): Null unified_document in paper ingestion — add null check before .hubs.add()
  • 4MGB (9 events): Persona webhook null first_name — default to empty string

All fixes are defensive guards with no behavioral changes to happy paths. Tests included.

Open in Web View Automation 

cursoragent and others added 2 commits March 17, 2026 13:28
Fixes RESEARCHHUB-BACKEND-4KKR: Handle deleted unified documents in
Personalize sync (14K events) - guard with DoesNotExist catch

Fixes RESEARCHHUB-BACKEND-4KTW: Handle deleted items in feed entry
creation (2.8K events) - catch DoesNotExist on content type lookup

Fixes RESEARCHHUB-BACKEND-4KQQ: Fix Hub.MultipleObjectsReturned in
get_from_subfield (3.1K events) - use filter().first() instead of get()

Fixes RESEARCHHUB-BACKEND-4MFH: Reduce Paper-not-found log noise in
github/x enrichment tasks (1K+ events) - downgrade logger.error to warning

Fixes RESEARCHHUB-BACKEND-4M79: Stop sending RelatedObjectDoesNotExist
to Sentry for missing author_profile (640 events) - catch specific exception

Fixes RESEARCHHUB-BACKEND-4KXM: Guard null unified_document in paper
ingestion (188 events) - null check before accessing hubs

Fixes RESEARCHHUB-BACKEND-4MGB: Handle null first_name/last_name in
Persona webhook (9 events) - default to empty string

Fixes RESEARCHHUB-BACKEND-4JW1: Handle GitHub 422 gracefully in metrics
enrichment (8.4K events) - treat as permanent skip, not error

Co-authored-by: Kobe Attias <kobeattias@gmail.com>
- Test sync_item_by_id handles deleted unified documents gracefully
- Test GitHub 422 is treated as skip (not error or retryable)
- Test GitHub 403 is treated as retryable
- Test Persona webhook handles null first_name/last_name

Co-authored-by: Kobe Attias <kobeattias@gmail.com>
@sonarqubecloud
Copy link
Copy Markdown

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