Skip to content

fix(bitbucket-server): Record 404 ApiError as halt in webhook - #121025

Draft
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/bitbucket-server-404-api-error-halt
Draft

fix(bitbucket-server): Record 404 ApiError as halt in webhook#121025
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/bitbucket-server-404-api-error-halt

Conversation

@sentry

@sentry sentry Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Previously, the Bitbucket Server webhook handler would capture ApiError exceptions with a 404 status code (e.g., when client.get_commits was called with a non-existent commit hash like '0000...0000' during a new branch push) as Sentry errors.

This occurred because ApiError was not explicitly caught before the generic except Exception block, unlike ApiHostError and ApiUnauthorized which correctly record a halt.

This change introduces an except ApiError as e: block. If the ApiError has a 404 status code, lifecycle.record_halt(halt_reason=e) is called, and the processing continues to the next change. This prevents noisy, non-actionable exceptions from being captured in Sentry, treating them as expected conditions.

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-3ZXM

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 Jul 31, 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