Skip to content

fix(eventstore): Handle Group.DoesNotExist in Event.group property#115253

Draft
sentry[bot] wants to merge 1 commit intomasterfrom
seer/fix/event-group-does-not-exist
Draft

fix(eventstore): Handle Group.DoesNotExist in Event.group property#115253
sentry[bot] wants to merge 1 commit intomasterfrom
seer/fix/event-group-does-not-exist

Conversation

@sentry
Copy link
Copy Markdown
Contributor

@sentry sentry Bot commented May 9, 2026

This PR addresses an issue where accessing `event.group` could lead to a `Group.DoesNotExist` exception, causing 500 errors on endpoints like `/api/0/organizations/{organization_id_or_slug}/events/{project_id_or_slug}:{event_id}/`.

The root cause was identified in src/sentry/services/eventstore/models.py within the Event.group property. The property directly calls Group.objects.get(id=self.group_id) without any exception handling. If the referenced Group object had been deleted or was not yet replicated, this call would raise Group.DoesNotExist, bubbling up and crashing the request.

The solution implemented wraps the Group.objects.get() call in a try-except Group.DoesNotExist block. If the Group is not found, None is returned and cached for subsequent accesses. This aligns the behavior with cases where self.group_id is None, ensuring that a missing group is gracefully handled without raising an exception. This makes the Event.group property more robust and prevents unexpected 500 errors.

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes SENTRY-3ZZB

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants