Skip to content

fix(release-health): Stop reporting Project.DoesNotExist for deleted projects - #121036

Draft
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/release-health-project-does-not-exist
Draft

fix(release-health): Stop reporting Project.DoesNotExist for deleted projects#121036
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/release-health-project-does-not-exist

Conversation

@sentry

@sentry sentry Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

This PR addresses the issue where Project.DoesNotExist errors were being reported in Sentry for deleted projects within the sentry.tasks.process_projects_with_sessions task, specifically in the _handle_release_adoption function.

The root cause was that project_id values originating from Snuba session totals could refer to projects that had since been deleted. While the Project.DoesNotExist exception was caught, capture_exception(exc) was still being called, leading to unnecessary error reports in Sentry.

The fix separates the Project.DoesNotExist exception from other exceptions in the _handle_release_adoption function. Instead of calling capture_exception, it now increments a metric (sentry.tasks.process_projects_with_sessions.project_not_found) and returns None silently. This is the appropriate behavior as a deleted project is an expected condition in this context, not an error that requires Sentry reporting. This change reduces noise in Sentry.

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-5HBA

Comment @sentry <feedback> on this PR to have Autofix iterate on the changes.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 2, 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